diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Internal/WirePathAttribute.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Internal/WirePathAttribute.cs
new file mode 100644
index 0000000000000..c6be2fc6eb6c2
--- /dev/null
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Internal/WirePathAttribute.cs
@@ -0,0 +1,27 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.MySql
+{
+ [AttributeUsage(AttributeTargets.Property)]
+ internal class WirePathAttribute : Attribute
+ {
+ private string _wirePath;
+
+ public WirePathAttribute(string wirePath)
+ {
+ _wirePath = wirePath;
+ }
+
+ public override string ToString()
+ {
+ return _wirePath;
+ }
+ }
+}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlAdvisorListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlAdvisorListResult.Serialization.cs
index 22d60f5c5ad97..6917a3162f0db 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlAdvisorListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlAdvisorListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlAdvisorListResult DeserializeMySqlAdvisorListResult(JsonEle
return new MySqlAdvisorListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlAdvisorListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlAdvisorListResult IPersistableModel.Create(BinaryDa
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlAdvisorListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlAdvisorListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.Serialization.cs
index 5fccabf9c30c1..b39ad13609c74 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlConfigurations DeserializeMySqlConfigurations(JsonElement e
return new MySqlConfigurations(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Values), out propertyOverride);
+ if (Optional.IsCollectionDefined(Values) || hasPropertyOverride)
+ {
+ if (Values.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Values)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlConfigurations)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlConfigurations IPersistableModel.Create(BinaryData dat
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlConfigurations(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlConfigurations)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.cs
index ef2a76374ffb4..75154028430bc 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlConfigurations.cs
@@ -62,6 +62,7 @@ internal MySqlConfigurations(IList values, IDictionary The list of server configurations.
+ [WirePath("value")]
public IList Values { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlDatabaseListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlDatabaseListResult.Serialization.cs
index 7228e8c17fa06..2948bfb56f8f0 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlDatabaseListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlDatabaseListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlDatabaseListResult DeserializeMySqlDatabaseListResult(JsonE
return new MySqlDatabaseListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlDatabaseListResult)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlDatabaseListResult IPersistableModel.Create(Binary
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlDatabaseListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlDatabaseListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlFirewallRuleListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlFirewallRuleListResult.Serialization.cs
index f83438d81e61a..21136fa1f6bbf 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlFirewallRuleListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlFirewallRuleListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlFirewallRuleListResult DeserializeMySqlFirewallRuleListResu
return new MySqlFirewallRuleListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrite
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlFirewallRuleListResult)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlFirewallRuleListResult IPersistableModel.Creat
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlFirewallRuleListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlFirewallRuleListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.Serialization.cs
index 5f47827f832c1..23157d9fea18c 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql;
@@ -223,6 +225,196 @@ internal static MySqlLogFile DeserializeMySqlLogFile(JsonElement element, ModelR
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SizeInKB), out propertyOverride);
+ if (Optional.IsDefined(SizeInKB) || hasPropertyOverride)
+ {
+ builder.Append(" sizeInKB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SizeInKB.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreatedOn), out propertyOverride);
+ if (Optional.IsDefined(CreatedOn) || hasPropertyOverride)
+ {
+ builder.Append(" createdTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(CreatedOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastModifiedOn), out propertyOverride);
+ if (Optional.IsDefined(LastModifiedOn) || hasPropertyOverride)
+ {
+ builder.Append(" lastModifiedTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(LastModifiedOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LogFileType), out propertyOverride);
+ if (Optional.IsDefined(LogFileType) || hasPropertyOverride)
+ {
+ builder.Append(" type: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (LogFileType.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{LogFileType}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{LogFileType}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uri), out propertyOverride);
+ if (Optional.IsDefined(Uri) || hasPropertyOverride)
+ {
+ builder.Append(" url: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Uri.AbsoluteUri}'");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -231,6 +423,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions option
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlLogFile)} does not support '{options.Format}' format.");
}
@@ -247,6 +441,8 @@ MySqlLogFile IPersistableModel.Create(BinaryData data, ModelReader
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlLogFile(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlLogFile)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.cs
index 00b6bfb95a35d..361444ce05188 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFile.cs
@@ -74,14 +74,19 @@ internal MySqlLogFile(ResourceIdentifier id, string name, ResourceType resourceT
}
/// Size of the log file.
+ [WirePath("properties.sizeInKB")]
public long? SizeInKB { get; set; }
/// Creation timestamp of the log file.
+ [WirePath("properties.createdTime")]
public DateTimeOffset? CreatedOn { get; }
/// Last modified timestamp of the log file.
+ [WirePath("properties.lastModifiedTime")]
public DateTimeOffset? LastModifiedOn { get; }
/// Type of the log file.
+ [WirePath("properties.type")]
public string LogFileType { get; set; }
/// The url to download the log file from.
+ [WirePath("properties.url")]
public Uri Uri { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFileListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFileListResult.Serialization.cs
index d5d656071af21..b95679eed3935 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFileListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlLogFileListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlLogFileListResult DeserializeMySqlLogFileListResult(JsonEle
return new MySqlLogFileListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlLogFileListResult)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlLogFileListResult IPersistableModel.Create(BinaryDa
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlLogFileListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlLogFileListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityContent.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityContent.cs
index c8a031316f2a8..8a013af997e30 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityContent.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityContent.cs
@@ -74,8 +74,10 @@ internal MySqlNameAvailabilityContent()
}
/// Resource name to verify.
+ [WirePath("name")]
public string Name { get; }
/// Resource type used for verification.
+ [WirePath("type")]
public ResourceType? ResourceType { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.Serialization.cs
index a2870a9a62060..b78c563c75f4b 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -115,6 +117,122 @@ internal static MySqlNameAvailabilityResult DeserializeMySqlNameAvailabilityResu
return new MySqlNameAvailabilityResult(message, nameAvailable, reason, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride);
+ if (Optional.IsDefined(Message) || hasPropertyOverride)
+ {
+ builder.Append(" message: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Message.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Message}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Message}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsNameAvailable), out propertyOverride);
+ if (Optional.IsDefined(IsNameAvailable) || hasPropertyOverride)
+ {
+ builder.Append(" nameAvailable: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var boolValue = IsNameAvailable.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Reason), out propertyOverride);
+ if (Optional.IsDefined(Reason) || hasPropertyOverride)
+ {
+ builder.Append(" reason: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Reason.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Reason}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Reason}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -123,6 +241,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrite
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlNameAvailabilityResult)} does not support '{options.Format}' format.");
}
@@ -139,6 +259,8 @@ MySqlNameAvailabilityResult IPersistableModel.Creat
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlNameAvailabilityResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlNameAvailabilityResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.cs
index bf4fbfc650bdc..7ed066d7aad90 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlNameAvailabilityResult.cs
@@ -64,10 +64,13 @@ internal MySqlNameAvailabilityResult(string message, bool? isNameAvailable, stri
}
/// Error Message.
+ [WirePath("message")]
public string Message { get; }
/// Indicates whether the resource name is available.
+ [WirePath("nameAvailable")]
public bool? IsNameAvailable { get; }
/// Reason for name being unavailable.
+ [WirePath("reason")]
public string Reason { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.Serialization.cs
index d16ea00c90fc0..d8a882fcb4936 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -213,6 +216,191 @@ internal static MySqlPerformanceTier DeserializeMySqlPerformanceTier(JsonElement
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Id.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Id}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxBackupRetentionDays), out propertyOverride);
+ if (Optional.IsDefined(MaxBackupRetentionDays) || hasPropertyOverride)
+ {
+ builder.Append(" maxBackupRetentionDays: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MaxBackupRetentionDays.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinBackupRetentionDays), out propertyOverride);
+ if (Optional.IsDefined(MinBackupRetentionDays) || hasPropertyOverride)
+ {
+ builder.Append(" minBackupRetentionDays: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MinBackupRetentionDays.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxStorageInMB), out propertyOverride);
+ if (Optional.IsDefined(MaxStorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" maxStorageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MaxStorageInMB.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinLargeStorageInMB), out propertyOverride);
+ if (Optional.IsDefined(MinLargeStorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" minLargeStorageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MinLargeStorageInMB.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxLargeStorageInMB), out propertyOverride);
+ if (Optional.IsDefined(MaxLargeStorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" maxLargeStorageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MaxLargeStorageInMB.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinStorageInMB), out propertyOverride);
+ if (Optional.IsDefined(MinStorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" minStorageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MinStorageInMB.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceLevelObjectives), out propertyOverride);
+ if (Optional.IsCollectionDefined(ServiceLevelObjectives) || hasPropertyOverride)
+ {
+ if (ServiceLevelObjectives.Any() || hasPropertyOverride)
+ {
+ builder.Append(" serviceLevelObjectives: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in ServiceLevelObjectives)
+ {
+ AppendChildObject(builder, item, options, 4, true, " serviceLevelObjectives: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -221,6 +409,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPerformanceTier)} does not support '{options.Format}' format.");
}
@@ -237,6 +427,8 @@ MySqlPerformanceTier IPersistableModel.Create(BinaryData d
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlPerformanceTier(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlPerformanceTier)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.cs
index c432ebbc893e8..26b06bddc2364 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTier.cs
@@ -76,20 +76,28 @@ internal MySqlPerformanceTier(string id, int? maxBackupRetentionDays, int? minBa
}
/// ID of the performance tier.
+ [WirePath("id")]
public string Id { get; }
/// Maximum Backup retention in days for the performance tier edition.
+ [WirePath("maxBackupRetentionDays")]
public int? MaxBackupRetentionDays { get; }
/// Minimum Backup retention in days for the performance tier edition.
+ [WirePath("minBackupRetentionDays")]
public int? MinBackupRetentionDays { get; }
/// Max storage allowed for a server.
+ [WirePath("maxStorageMB")]
public int? MaxStorageInMB { get; }
/// Max storage allowed for a server.
+ [WirePath("minLargeStorageMB")]
public int? MinLargeStorageInMB { get; }
/// Max storage allowed for a server.
+ [WirePath("maxLargeStorageMB")]
public int? MaxLargeStorageInMB { get; }
/// Max storage allowed for a server.
+ [WirePath("minStorageMB")]
public int? MinStorageInMB { get; }
/// Service level objectives associated with the performance tier.
+ [WirePath("serviceLevelObjectives")]
public IReadOnlyList ServiceLevelObjectives { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierListResult.Serialization.cs
index 44ee21e45548a..a66d52b0d65e2 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlPerformanceTierListResult DeserializeMySqlPerformanceTierLi
return new MySqlPerformanceTierListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelReaderWr
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPerformanceTierListResult)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlPerformanceTierListResult IPersistableModel
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlPerformanceTierListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlPerformanceTierListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierServiceLevelObjectives.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierServiceLevelObjectives.Serialization.cs
index 0a796b3ffaf08..e3db9b16359ba 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierServiceLevelObjectives.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPerformanceTierServiceLevelObjectives.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -195,6 +197,199 @@ internal static MySqlPerformanceTierServiceLevelObjectives DeserializeMySqlPerfo
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Id.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Id}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Edition), out propertyOverride);
+ if (Optional.IsDefined(Edition) || hasPropertyOverride)
+ {
+ builder.Append(" edition: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Edition.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Edition}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Edition}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VCores), out propertyOverride);
+ if (Optional.IsDefined(VCores) || hasPropertyOverride)
+ {
+ builder.Append(" vCore: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{VCores.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HardwareGeneration), out propertyOverride);
+ if (Optional.IsDefined(HardwareGeneration) || hasPropertyOverride)
+ {
+ builder.Append(" hardwareGeneration: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (HardwareGeneration.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{HardwareGeneration}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{HardwareGeneration}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxBackupRetentionDays), out propertyOverride);
+ if (Optional.IsDefined(MaxBackupRetentionDays) || hasPropertyOverride)
+ {
+ builder.Append(" maxBackupRetentionDays: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MaxBackupRetentionDays.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinBackupRetentionDays), out propertyOverride);
+ if (Optional.IsDefined(MinBackupRetentionDays) || hasPropertyOverride)
+ {
+ builder.Append(" minBackupRetentionDays: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MinBackupRetentionDays.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxStorageInMB), out propertyOverride);
+ if (Optional.IsDefined(MaxStorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" maxStorageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MaxStorageInMB.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinStorageInMB), out propertyOverride);
+ if (Optional.IsDefined(MinStorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" minStorageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{MinStorageInMB.Value}");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -203,6 +398,8 @@ BinaryData IPersistableModel.Write(M
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPerformanceTierServiceLevelObjectives)} does not support '{options.Format}' format.");
}
@@ -219,6 +416,8 @@ MySqlPerformanceTierServiceLevelObjectives IPersistableModel ID for the service level objective.
+ [WirePath("id")]
public string Id { get; }
/// Edition of the performance tier.
+ [WirePath("edition")]
public string Edition { get; }
/// vCore associated with the service level objective.
+ [WirePath("vCore")]
public int? VCores { get; }
/// Hardware generation associated with the service level objective.
+ [WirePath("hardwareGeneration")]
public string HardwareGeneration { get; }
/// Maximum Backup retention in days for the performance tier edition.
+ [WirePath("maxBackupRetentionDays")]
public int? MaxBackupRetentionDays { get; }
/// Minimum Backup retention in days for the performance tier edition.
+ [WirePath("minBackupRetentionDays")]
public int? MinBackupRetentionDays { get; }
/// Max storage allowed for a server.
+ [WirePath("maxStorageMB")]
public int? MaxStorageInMB { get; }
/// Max storage allowed for a server.
+ [WirePath("minStorageMB")]
public int? MinStorageInMB { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateEndpointConnectionListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateEndpointConnectionListResult.Serialization.cs
index 0152b505c4f53..c757bfa0e39c3 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateEndpointConnectionListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateEndpointConnectionListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlPrivateEndpointConnectionListResult DeserializeMySqlPrivate
return new MySqlPrivateEndpointConnectionListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(Mod
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPrivateEndpointConnectionListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlPrivateEndpointConnectionListResult IPersistableModel tags, I
}
/// Resource tags.
+ [WirePath("tags")]
public IDictionary Tags { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkResourceListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkResourceListResult.Serialization.cs
index dbde24979e6da..51ed4d93cbe70 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkResourceListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkResourceListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlPrivateLinkResourceListResult DeserializeMySqlPrivateLinkRe
return new MySqlPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelRead
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPrivateLinkResourceListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlPrivateLinkResourceListResult IPersistableModel(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride);
+ if (Optional.IsDefined(GroupId) || hasPropertyOverride)
+ {
+ builder.Append(" groupId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (GroupId.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{GroupId}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{GroupId}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride);
+ if (Optional.IsCollectionDefined(RequiredMembers) || hasPropertyOverride)
+ {
+ if (RequiredMembers.Any() || hasPropertyOverride)
+ {
+ builder.Append(" requiredMembers: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in RequiredMembers)
+ {
+ if (item == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Contains(Environment.NewLine))
+ {
+ builder.AppendLine(" '''");
+ builder.AppendLine($"{item}'''");
+ }
+ else
+ {
+ builder.AppendLine($" '{item}'");
+ }
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +239,8 @@ BinaryData IPersistableModel.Write(ModelRead
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPrivateLinkResourceProperties)} does not support '{options.Format}' format.");
}
@@ -138,6 +257,8 @@ MySqlPrivateLinkResourceProperties IPersistableModel The private link resource group id.
+ [WirePath("groupId")]
public string GroupId { get; }
/// The private link resource required member names.
+ [WirePath("requiredMembers")]
public IReadOnlyList RequiredMembers { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkServiceConnectionStateProperty.Serialization.cs
index b2f47a578b41a..408ba89c7ade2 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkServiceConnectionStateProperty.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlPrivateLinkServiceConnectionStateProperty.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -105,6 +107,129 @@ internal static MySqlPrivateLinkServiceConnectionStateProperty DeserializeMySqlP
return new MySqlPrivateLinkServiceConnectionStateProperty(status, description, actionsRequired, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride);
+ if (Optional.IsDefined(Status) || hasPropertyOverride)
+ {
+ builder.Append(" status: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Status.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Status}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Status}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride);
+ if (Optional.IsDefined(Description) || hasPropertyOverride)
+ {
+ builder.Append(" description: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Description.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Description}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Description}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionsRequired), out propertyOverride);
+ if (Optional.IsDefined(ActionsRequired) || hasPropertyOverride)
+ {
+ builder.Append(" actionsRequired: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (ActionsRequired.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ActionsRequired}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ActionsRequired}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -113,6 +238,8 @@ BinaryData IPersistableModel.Wri
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPrivateLinkServiceConnectionStateProperty)} does not support '{options.Format}' format.");
}
@@ -129,6 +256,8 @@ MySqlPrivateLinkServiceConnectionStateProperty IPersistableModel The private link service connection status.
+ [WirePath("status")]
public string Status { get; set; }
/// The private link service connection description.
+ [WirePath("description")]
public string Description { get; set; }
/// The actions required for private link service connection.
+ [WirePath("actionsRequired")]
public string ActionsRequired { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryPerformanceInsightResetDataResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryPerformanceInsightResetDataResult.Serialization.cs
index 7440ca950ae05..c4044ec305c8b 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryPerformanceInsightResetDataResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryPerformanceInsightResetDataResult.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -104,6 +106,99 @@ internal static MySqlQueryPerformanceInsightResetDataResult DeserializeMySqlQuer
return new MySqlQueryPerformanceInsightResetDataResult(status, message, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride);
+ if (Optional.IsDefined(Status) || hasPropertyOverride)
+ {
+ builder.Append(" status: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Status.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride);
+ if (Optional.IsDefined(Message) || hasPropertyOverride)
+ {
+ builder.Append(" message: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Message.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Message}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Message}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -112,6 +207,8 @@ BinaryData IPersistableModel.Write(
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlQueryPerformanceInsightResetDataResult)} does not support '{options.Format}' format.");
}
@@ -128,6 +225,8 @@ MySqlQueryPerformanceInsightResetDataResult IPersistableModel Indicates result of the operation.
+ [WirePath("status")]
public MySqlQueryPerformanceInsightResetDataResultState? Status { get; }
/// operation message.
+ [WirePath("message")]
public string Message { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryTextListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryTextListResult.Serialization.cs
index 4b4d410273ee7..b9f40341df63d 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryTextListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlQueryTextListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlQueryTextListResult DeserializeMySqlQueryTextListResult(Jso
return new MySqlQueryTextListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlQueryTextListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlQueryTextListResult IPersistableModel.Create(Bina
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlQueryTextListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlQueryTextListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlRecommendationActionListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlRecommendationActionListResult.Serialization.cs
index 35324c07530f8..a5fa1c3dba094 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlRecommendationActionListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlRecommendationActionListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlRecommendationActionListResult DeserializeMySqlRecommendati
return new MySqlRecommendationActionListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelRea
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlRecommendationActionListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlRecommendationActionListResult IPersistableModel propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastAvailableBackupOn), out propertyOverride);
+ if (Optional.IsDefined(LastAvailableBackupOn) || hasPropertyOverride)
+ {
+ builder.Append(" lastAvailableBackupDateTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(LastAvailableBackupOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceLevelObjective), out propertyOverride);
+ if (Optional.IsDefined(ServiceLevelObjective) || hasPropertyOverride)
+ {
+ builder.Append(" serviceLevelObjective: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (ServiceLevelObjective.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ServiceLevelObjective}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ServiceLevelObjective}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Edition), out propertyOverride);
+ if (Optional.IsDefined(Edition) || hasPropertyOverride)
+ {
+ builder.Append(" edition: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Edition.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Edition}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Edition}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VCores), out propertyOverride);
+ if (Optional.IsDefined(VCores) || hasPropertyOverride)
+ {
+ builder.Append(" vCore: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{VCores.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HardwareGeneration), out propertyOverride);
+ if (Optional.IsDefined(HardwareGeneration) || hasPropertyOverride)
+ {
+ builder.Append(" hardwareGeneration: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (HardwareGeneration.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{HardwareGeneration}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{HardwareGeneration}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride);
+ if (Optional.IsDefined(Version) || hasPropertyOverride)
+ {
+ builder.Append(" version: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Version.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Version}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Version}'");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -235,6 +464,8 @@ BinaryData IPersistableModel.Write(ModelRead
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlRecoverableServerResourceData)} does not support '{options.Format}' format.");
}
@@ -251,6 +482,8 @@ MySqlRecoverableServerResourceData IPersistableModel The last available backup date time.
+ [WirePath("properties.lastAvailableBackupDateTime")]
public DateTimeOffset? LastAvailableBackupOn { get; }
/// The service level objective.
+ [WirePath("properties.serviceLevelObjective")]
public string ServiceLevelObjective { get; }
/// Edition of the performance tier.
+ [WirePath("properties.edition")]
public string Edition { get; }
/// vCore associated with the service level objective.
+ [WirePath("properties.vCore")]
public int? VCores { get; }
/// Hardware generation associated with the service level objective.
+ [WirePath("properties.hardwareGeneration")]
public string HardwareGeneration { get; }
/// The MySQL version.
+ [WirePath("properties.version")]
public string Version { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerAdministratorListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerAdministratorListResult.Serialization.cs
index 23689247556bb..a36dedc802811 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerAdministratorListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerAdministratorListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlServerAdministratorListResult DeserializeMySqlServerAdminis
return new MySqlServerAdministratorListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelRead
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerAdministratorListResult)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlServerAdministratorListResult IPersistableModel The Azure Active Directory identity of the server. Current supported identity types: SystemAssigned.
+ [WirePath("identity")]
public ManagedServiceIdentity Identity { get; set; }
/// The SKU (pricing tier) of the server.
+ [WirePath("sku")]
public MySqlSku Sku { get; set; }
///
/// Properties of the server.
/// 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 .
///
+ [WirePath("properties")]
public MySqlServerPropertiesForCreate Properties { get; }
/// The location the resource resides in.
+ [WirePath("location")]
public AzureLocation Location { get; }
/// Application-specific metadata in the form of key-value pairs.
+ [WirePath("tags")]
public IDictionary Tags { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerKeyListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerKeyListResult.Serialization.cs
index bbd0034e5058c..11c5c8ff8dad7 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerKeyListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerKeyListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlServerKeyListResult DeserializeMySqlServerKeyListResult(Jso
return new MySqlServerKeyListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerKeyListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlServerKeyListResult IPersistableModel.Create(Bina
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlServerKeyListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlServerKeyListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerListResult.Serialization.cs
index f556af92f4e18..4bc76aae29664 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -103,6 +106,85 @@ internal static MySqlServerListResult DeserializeMySqlServerListResult(JsonEleme
return new MySqlServerListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -111,6 +193,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerListResult)} does not support '{options.Format}' format.");
}
@@ -127,6 +211,8 @@ MySqlServerListResult IPersistableModel.Create(BinaryData
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlServerListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlServerListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPatch.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPatch.cs
index c1da7ea5ae87a..a707d6cbca7ce 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPatch.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPatch.cs
@@ -81,24 +81,34 @@ internal MySqlServerPatch(ManagedServiceIdentity identity, MySqlSku sku, IDictio
}
/// The Azure Active Directory identity of the server. Current supported identity types: SystemAssigned.
+ [WirePath("identity")]
public ManagedServiceIdentity Identity { get; set; }
/// The SKU (pricing tier) of the server.
+ [WirePath("sku")]
public MySqlSku Sku { get; set; }
/// Application-specific metadata in the form of key-value pairs.
+ [WirePath("tags")]
public IDictionary Tags { get; }
/// Storage profile of a server.
+ [WirePath("properties.storageProfile")]
public MySqlStorageProfile StorageProfile { get; set; }
/// The password of the administrator login.
+ [WirePath("properties.administratorLoginPassword")]
public string AdministratorLoginPassword { get; set; }
/// The version of a server.
+ [WirePath("properties.version")]
public MySqlServerVersion? Version { get; set; }
/// Enable ssl enforcement or not when connect to server.
+ [WirePath("properties.sslEnforcement")]
public MySqlSslEnforcementEnum? SslEnforcement { get; set; }
/// Enforce a minimal Tls version for the server.
+ [WirePath("properties.minimalTlsVersion")]
public MySqlMinimalTlsVersionEnum? MinimalTlsVersion { get; set; }
/// Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'.
+ [WirePath("properties.publicNetworkAccess")]
public MySqlPublicNetworkAccessEnum? PublicNetworkAccess { get; set; }
/// The replication role of the server.
+ [WirePath("properties.replicationRole")]
public string ReplicationRole { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnection.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnection.Serialization.cs
index 174357fd89ba2..9f9fb007e921b 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnection.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnection.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -108,6 +110,91 @@ internal static MySqlServerPrivateEndpointConnection DeserializeMySqlServerPriva
return new MySqlServerPrivateEndpointConnection(id, properties, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride);
+ if (Optional.IsDefined(Properties) || hasPropertyOverride)
+ {
+ builder.Append(" properties: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, Properties, options, 2, false, " properties: ");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -116,6 +203,8 @@ BinaryData IPersistableModel.Write(ModelRe
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerPrivateEndpointConnection)} does not support '{options.Format}' format.");
}
@@ -132,6 +221,8 @@ MySqlServerPrivateEndpointConnection IPersistableModel Resource Id of the private endpoint connection.
+ [WirePath("id")]
public ResourceIdentifier Id { get; }
/// Private endpoint connection properties.
+ [WirePath("properties")]
public MySqlServerPrivateEndpointConnectionProperties Properties { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnectionProperties.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnectionProperties.Serialization.cs
index dfbef117f0e16..047861466eadd 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnectionProperties.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateEndpointConnectionProperties.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
using Azure.ResourceManager.Resources.Models;
@@ -124,6 +126,105 @@ internal static MySqlServerPrivateEndpointConnectionProperties DeserializeMySqlS
return new MySqlServerPrivateEndpointConnectionProperties(privateEndpoint, privateLinkServiceConnectionState, provisioningState, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpoint), out propertyOverride);
+ if (Optional.IsDefined(PrivateEndpoint) || hasPropertyOverride)
+ {
+ builder.Append(" privateEndpoint: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, PrivateEndpoint, options, 2, false, " privateEndpoint: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateLinkServiceConnectionState), out propertyOverride);
+ if (Optional.IsDefined(PrivateLinkServiceConnectionState) || hasPropertyOverride)
+ {
+ builder.Append(" privateLinkServiceConnectionState: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, PrivateLinkServiceConnectionState, options, 2, false, " privateLinkServiceConnectionState: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride);
+ if (Optional.IsDefined(ProvisioningState) || hasPropertyOverride)
+ {
+ builder.Append(" provisioningState: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{ProvisioningState.Value.ToString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -132,6 +233,8 @@ BinaryData IPersistableModel.Wri
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerPrivateEndpointConnectionProperties)} does not support '{options.Format}' format.");
}
@@ -148,6 +251,8 @@ MySqlServerPrivateEndpointConnectionProperties IPersistableModel Private endpoint which the connection belongs to.
internal WritableSubResource PrivateEndpoint { get; }
/// Gets or sets Id.
+ [WirePath("privateEndpoint.id")]
public ResourceIdentifier PrivateEndpointId
{
get => PrivateEndpoint?.Id;
}
/// Connection state of the private endpoint connection.
+ [WirePath("privateLinkServiceConnectionState")]
public MySqlServerPrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; }
/// State of the private endpoint connection.
+ [WirePath("provisioningState")]
public MySqlPrivateEndpointProvisioningState? ProvisioningState { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateLinkServiceConnectionStateProperty.Serialization.cs
index 1911caaf33d1c..cc2f843585e60 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateLinkServiceConnectionStateProperty.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPrivateLinkServiceConnectionStateProperty.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -109,6 +111,110 @@ internal static MySqlServerPrivateLinkServiceConnectionStateProperty Deserialize
return new MySqlServerPrivateLinkServiceConnectionStateProperty(status, description, actionsRequired, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride);
+ builder.Append(" status: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Status.ToString()}'");
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride);
+ if (Optional.IsDefined(Description) || hasPropertyOverride)
+ {
+ builder.Append(" description: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Description.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Description}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Description}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionsRequired), out propertyOverride);
+ if (Optional.IsDefined(ActionsRequired) || hasPropertyOverride)
+ {
+ builder.Append(" actionsRequired: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{ActionsRequired.Value.ToString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -117,6 +223,8 @@ BinaryData IPersistableModel The private link service connection status.
+ [WirePath("status")]
public MySqlPrivateLinkServiceConnectionStateStatus Status { get; }
/// The private link service connection description.
+ [WirePath("description")]
public string Description { get; }
/// The actions required for private link service connection.
+ [WirePath("actionsRequired")]
public MySqlPrivateLinkServiceConnectionStateRequiredAction? ActionsRequired { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForCreate.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForCreate.cs
index 84fbb9e22a83a..9f0c62d795629 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForCreate.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForCreate.cs
@@ -76,16 +76,22 @@ internal MySqlServerPropertiesForCreate(MySqlServerVersion? version, MySqlSslEnf
}
/// Server version.
+ [WirePath("version")]
public MySqlServerVersion? Version { get; set; }
/// Enable ssl enforcement or not when connect to server.
+ [WirePath("sslEnforcement")]
public MySqlSslEnforcementEnum? SslEnforcement { get; set; }
/// Enforce a minimal Tls version for the server.
+ [WirePath("minimalTlsVersion")]
public MySqlMinimalTlsVersionEnum? MinimalTlsVersion { get; set; }
/// Status showing whether the server enabled infrastructure encryption.
+ [WirePath("infrastructureEncryption")]
public MySqlInfrastructureEncryption? InfrastructureEncryption { get; set; }
/// Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'.
+ [WirePath("publicNetworkAccess")]
public MySqlPublicNetworkAccessEnum? PublicNetworkAccess { get; set; }
/// Storage profile of a server.
+ [WirePath("storageProfile")]
public MySqlStorageProfile StorageProfile { get; set; }
/// The mode to create a new server.
internal MySqlCreateMode CreateMode { get; set; }
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForDefaultCreate.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForDefaultCreate.cs
index bba81b128ace3..205b0d7acbb36 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForDefaultCreate.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForDefaultCreate.cs
@@ -52,8 +52,10 @@ internal MySqlServerPropertiesForDefaultCreate()
}
/// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). The login name is required when updating password.
+ [WirePath("administratorLogin")]
public string AdministratorLogin { get; }
/// The password of the administrator login.
+ [WirePath("administratorLoginPassword")]
public string AdministratorLoginPassword { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForGeoRestore.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForGeoRestore.cs
index 3f53d919d3d8c..9abe14821b2b8 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForGeoRestore.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForGeoRestore.cs
@@ -48,6 +48,7 @@ internal MySqlServerPropertiesForGeoRestore()
}
/// The source server id to restore from.
+ [WirePath("sourceServerId")]
public ResourceIdentifier SourceServerId { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForReplica.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForReplica.cs
index 14a71d3e993b7..7d31413dbacd1 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForReplica.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForReplica.cs
@@ -48,6 +48,7 @@ internal MySqlServerPropertiesForReplica()
}
/// The master server id to create replica from.
+ [WirePath("sourceServerId")]
public ResourceIdentifier SourceServerId { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForRestore.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForRestore.cs
index 866505e83fda9..f58cb43069591 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForRestore.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerPropertiesForRestore.cs
@@ -52,8 +52,10 @@ internal MySqlServerPropertiesForRestore()
}
/// The source server id to restore from.
+ [WirePath("sourceServerId")]
public ResourceIdentifier SourceServerId { get; }
/// Restore point creation time (ISO8601 format), specifying the time to restore from.
+ [WirePath("restorePointInTime")]
public DateTimeOffset RestorePointInTime { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerSecurityAlertPolicyListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerSecurityAlertPolicyListResult.Serialization.cs
index 375950feba684..df09fecbb6a25 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerSecurityAlertPolicyListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlServerSecurityAlertPolicyListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlServerSecurityAlertPolicyListResult DeserializeMySqlServerS
return new MySqlServerSecurityAlertPolicyListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(Mod
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerSecurityAlertPolicyListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlServerSecurityAlertPolicyListResult IPersistableModel Represents an server storage profile.
+ [WirePath("properties.targetServerVersion")]
public string TargetServerVersion { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.Serialization.cs
index 0a85e7b9c1c5f..c3a060c6d6bd0 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -144,6 +146,157 @@ internal static MySqlSku DeserializeMySqlSku(JsonElement element, ModelReaderWri
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tier), out propertyOverride);
+ if (Optional.IsDefined(Tier) || hasPropertyOverride)
+ {
+ builder.Append(" tier: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Tier.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Capacity), out propertyOverride);
+ if (Optional.IsDefined(Capacity) || hasPropertyOverride)
+ {
+ builder.Append(" capacity: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{Capacity.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Size), out propertyOverride);
+ if (Optional.IsDefined(Size) || hasPropertyOverride)
+ {
+ builder.Append(" size: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Size.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Size}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Size}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Family), out propertyOverride);
+ if (Optional.IsDefined(Family) || hasPropertyOverride)
+ {
+ builder.Append(" family: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Family.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Family}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Family}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -152,6 +305,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlSku)} does not support '{options.Format}' format.");
}
@@ -168,6 +323,8 @@ MySqlSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOp
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlSku(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlSku)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.cs
index 3505067ab16c7..4e28cde6a1175 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlSku.cs
@@ -79,14 +79,19 @@ internal MySqlSku()
}
/// The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.
+ [WirePath("name")]
public string Name { get; set; }
/// The tier of the particular SKU, e.g. Basic.
+ [WirePath("tier")]
public MySqlSkuTier? Tier { get; set; }
/// The scale up/out capacity, representing server's compute units.
+ [WirePath("capacity")]
public int? Capacity { get; set; }
/// The size code, to be interpreted by resource as appropriate.
+ [WirePath("size")]
public string Size { get; set; }
/// The family of hardware.
+ [WirePath("family")]
public string Family { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.Serialization.cs
index b1d6a5ed4adea..3fb89c39465f1 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -138,6 +140,119 @@ internal static MySqlStorageProfile DeserializeMySqlStorageProfile(JsonElement e
return new MySqlStorageProfile(backupRetentionDays, geoRedundantBackup, storageMB, storageAutogrow, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BackupRetentionDays), out propertyOverride);
+ if (Optional.IsDefined(BackupRetentionDays) || hasPropertyOverride)
+ {
+ builder.Append(" backupRetentionDays: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{BackupRetentionDays.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GeoRedundantBackup), out propertyOverride);
+ if (Optional.IsDefined(GeoRedundantBackup) || hasPropertyOverride)
+ {
+ builder.Append(" geoRedundantBackup: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{GeoRedundantBackup.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageInMB), out propertyOverride);
+ if (Optional.IsDefined(StorageInMB) || hasPropertyOverride)
+ {
+ builder.Append(" storageMB: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{StorageInMB.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageAutogrow), out propertyOverride);
+ if (Optional.IsDefined(StorageAutogrow) || hasPropertyOverride)
+ {
+ builder.Append(" storageAutogrow: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{StorageAutogrow.Value.ToString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -146,6 +261,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlStorageProfile)} does not support '{options.Format}' format.");
}
@@ -162,6 +279,8 @@ MySqlStorageProfile IPersistableModel.Create(BinaryData dat
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlStorageProfile(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlStorageProfile)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.cs
index aa6dbd0e5389a..21e3ced211e79 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlStorageProfile.cs
@@ -66,12 +66,16 @@ internal MySqlStorageProfile(int? backupRetentionDays, MySqlGeoRedundantBackup?
}
/// Backup retention days for the server.
+ [WirePath("backupRetentionDays")]
public int? BackupRetentionDays { get; set; }
/// Enable Geo-redundant or not for server backup.
+ [WirePath("geoRedundantBackup")]
public MySqlGeoRedundantBackup? GeoRedundantBackup { get; set; }
/// Max storage allowed for a server.
+ [WirePath("storageMB")]
public int? StorageInMB { get; set; }
/// Enable Storage Auto Grow.
+ [WirePath("storageAutogrow")]
public MySqlStorageAutogrow? StorageAutogrow { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsInput.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsInput.cs
index fc5fce6ce3969..80419cff33c13 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsInput.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsInput.cs
@@ -93,16 +93,22 @@ internal MySqlTopQueryStatisticsInput()
}
/// Max number of top queries to return.
+ [WirePath("properties.numberOfTopQueries")]
public int NumberOfTopQueries { get; }
/// Aggregation function name.
+ [WirePath("properties.aggregationFunction")]
public string AggregationFunction { get; }
/// Observed metric name.
+ [WirePath("properties.observedMetric")]
public string ObservedMetric { get; }
/// Observation start time.
+ [WirePath("properties.observationStartTime")]
public DateTimeOffset ObservationStartOn { get; }
/// Observation end time.
+ [WirePath("properties.observationEndTime")]
public DateTimeOffset ObservationEndOn { get; }
/// Aggregation interval type in ISO 8601 format.
+ [WirePath("properties.aggregationWindow")]
public string AggregationWindow { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsListResult.Serialization.cs
index 0df962fb8c418..291c2046c0997 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlTopQueryStatisticsListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlTopQueryStatisticsListResult DeserializeMySqlTopQueryStatis
return new MySqlTopQueryStatisticsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelReade
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlTopQueryStatisticsListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlTopQueryStatisticsListResult IPersistableModel(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelReade
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlVirtualNetworkRuleListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlVirtualNetworkRuleListResult IPersistableModel Observation start time.
+ [WirePath("properties.observationStartTime")]
public DateTimeOffset ObservationStartOn { get; }
/// Observation end time.
+ [WirePath("properties.observationEndTime")]
public DateTimeOffset ObservationEndOn { get; }
/// Aggregation interval type in ISO 8601 format.
+ [WirePath("properties.aggregationWindow")]
public string AggregationWindow { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlWaitStatisticsListResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlWaitStatisticsListResult.Serialization.cs
index 8e257ad3a8d90..8c93ac059c7ab 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlWaitStatisticsListResult.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Models/MySqlWaitStatisticsListResult.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
namespace Azure.ResourceManager.MySql.Models
@@ -114,6 +117,107 @@ internal static MySqlWaitStatisticsListResult DeserializeMySqlWaitStatisticsList
return new MySqlWaitStatisticsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsCollectionDefined(Value) || hasPropertyOverride)
+ {
+ if (Value.Any() || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (Optional.IsDefined(NextLink) || hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -122,6 +226,8 @@ BinaryData IPersistableModel.Write(ModelReaderWri
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlWaitStatisticsListResult)} does not support '{options.Format}' format.");
}
@@ -138,6 +244,8 @@ MySqlWaitStatisticsListResult IPersistableModel.C
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlWaitStatisticsListResult(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlWaitStatisticsListResult)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.Serialization.cs
index 4c49fb2053960..0e6cc73523fc8 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -154,6 +156,127 @@ internal static MySqlAdvisorData DeserializeMySqlAdvisorData(JsonElement element
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride);
+ if (Optional.IsDefined(Properties) || hasPropertyOverride)
+ {
+ builder.Append(" properties: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Properties.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -162,6 +285,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlAdvisorData)} does not support '{options.Format}' format.");
}
@@ -178,6 +303,8 @@ MySqlAdvisorData IPersistableModel.Create(BinaryData data, Mod
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlAdvisorData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlAdvisorData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.cs
index 707f114152de9..edb1f7ad74c0c 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorData.cs
@@ -98,6 +98,7 @@ internal MySqlAdvisorData(ResourceIdentifier id, string name, ResourceType resou
///
///
///
+ [WirePath("properties")]
public BinaryData Properties { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.Serialization.cs
index d14703666f975..518e7c5c9ac05 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -218,6 +220,248 @@ internal static MySqlConfigurationData DeserializeMySqlConfigurationData(JsonEle
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (Optional.IsDefined(Value) || hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Value.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Value}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Value}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride);
+ if (Optional.IsDefined(Description) || hasPropertyOverride)
+ {
+ builder.Append(" description: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Description.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Description}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Description}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultValue), out propertyOverride);
+ if (Optional.IsDefined(DefaultValue) || hasPropertyOverride)
+ {
+ builder.Append(" defaultValue: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (DefaultValue.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{DefaultValue}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{DefaultValue}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DataType), out propertyOverride);
+ if (Optional.IsDefined(DataType) || hasPropertyOverride)
+ {
+ builder.Append(" dataType: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (DataType.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{DataType}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{DataType}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowedValues), out propertyOverride);
+ if (Optional.IsDefined(AllowedValues) || hasPropertyOverride)
+ {
+ builder.Append(" allowedValues: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (AllowedValues.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{AllowedValues}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{AllowedValues}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Source), out propertyOverride);
+ if (Optional.IsDefined(Source) || hasPropertyOverride)
+ {
+ builder.Append(" source: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Source.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Source}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Source}'");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -226,6 +470,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlConfigurationData)} does not support '{options.Format}' format.");
}
@@ -242,6 +488,8 @@ MySqlConfigurationData IPersistableModel.Create(BinaryDa
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlConfigurationData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlConfigurationData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.cs
index d86ccbd6b5e77..4f4f06351ee02 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationData.cs
@@ -79,16 +79,22 @@ internal MySqlConfigurationData(ResourceIdentifier id, string name, ResourceType
}
/// Value of the configuration.
+ [WirePath("properties.value")]
public string Value { get; set; }
/// Description of the configuration.
+ [WirePath("properties.description")]
public string Description { get; }
/// Default value of the configuration.
+ [WirePath("properties.defaultValue")]
public string DefaultValue { get; }
/// Data type of the configuration.
+ [WirePath("properties.dataType")]
public string DataType { get; }
/// Allowed values of the configuration.
+ [WirePath("properties.allowedValues")]
public string AllowedValues { get; }
/// Source of the configuration.
+ [WirePath("properties.source")]
public string Source { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.Serialization.cs
index dd5c5cccad714..5399ab655db45 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -170,6 +172,160 @@ internal static MySqlDatabaseData DeserializeMySqlDatabaseData(JsonElement eleme
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Charset), out propertyOverride);
+ if (Optional.IsDefined(Charset) || hasPropertyOverride)
+ {
+ builder.Append(" charset: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Charset.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Charset}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Charset}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Collation), out propertyOverride);
+ if (Optional.IsDefined(Collation) || hasPropertyOverride)
+ {
+ builder.Append(" collation: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Collation.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Collation}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Collation}'");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -178,6 +334,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlDatabaseData)} does not support '{options.Format}' format.");
}
@@ -194,6 +352,8 @@ MySqlDatabaseData IPersistableModel.Create(BinaryData data, M
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlDatabaseData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlDatabaseData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.cs
index 6fe6540f887d2..6746252ee39f9 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseData.cs
@@ -71,8 +71,10 @@ internal MySqlDatabaseData(ResourceIdentifier id, string name, ResourceType reso
}
/// The charset of the database.
+ [WirePath("properties.charset")]
public string Charset { get; set; }
/// The collation of the database.
+ [WirePath("properties.collation")]
public string Collation { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.Serialization.cs
index 4458d561eae05..5c4874c28d192 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.Serialization.cs
@@ -9,8 +9,10 @@
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Net;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -165,6 +167,144 @@ internal static MySqlFirewallRuleData DeserializeMySqlFirewallRuleData(JsonEleme
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartIPAddress), out propertyOverride);
+ if (Optional.IsDefined(StartIPAddress) || hasPropertyOverride)
+ {
+ builder.Append(" startIpAddress: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{StartIPAddress.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndIPAddress), out propertyOverride);
+ if (Optional.IsDefined(EndIPAddress) || hasPropertyOverride)
+ {
+ builder.Append(" endIpAddress: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{EndIPAddress.ToString()}'");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -173,6 +313,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlFirewallRuleData)} does not support '{options.Format}' format.");
}
@@ -189,6 +331,8 @@ MySqlFirewallRuleData IPersistableModel.Create(BinaryData
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlFirewallRuleData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlFirewallRuleData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.cs
index b9da228cb4f33..de0289d7e4e34 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleData.cs
@@ -85,8 +85,10 @@ internal MySqlFirewallRuleData()
}
/// The start IP address of the server firewall rule. Must be IPv4 format.
+ [WirePath("properties.startIpAddress")]
public IPAddress StartIPAddress { get; set; }
/// The end IP address of the server firewall rule. Must be IPv4 format.
+ [WirePath("properties.endIpAddress")]
public IPAddress EndIPAddress { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionData.Serialization.cs
index cd254dc4bf985..56f63b723e771 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql.Models;
using Azure.ResourceManager.Resources.Models;
@@ -192,6 +194,166 @@ internal static MySqlPrivateEndpointConnectionData DeserializeMySqlPrivateEndpoi
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpoint), out propertyOverride);
+ if (Optional.IsDefined(PrivateEndpoint) || hasPropertyOverride)
+ {
+ builder.Append(" privateEndpoint: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionState), out propertyOverride);
+ if (Optional.IsDefined(ConnectionState) || hasPropertyOverride)
+ {
+ builder.Append(" privateLinkServiceConnectionState: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, ConnectionState, options, 4, false, " privateLinkServiceConnectionState: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride);
+ if (Optional.IsDefined(ProvisioningState) || hasPropertyOverride)
+ {
+ builder.Append(" provisioningState: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (ProvisioningState.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ProvisioningState}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ProvisioningState}'");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -200,6 +362,8 @@ BinaryData IPersistableModel.Write(ModelRead
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPrivateEndpointConnectionData)} does not support '{options.Format}' format.");
}
@@ -216,6 +380,8 @@ MySqlPrivateEndpointConnectionData IPersistableModel Private endpoint which the connection belongs to.
internal WritableSubResource PrivateEndpoint { get; set; }
/// Gets or sets Id.
+ [WirePath("properties.privateEndpoint.id")]
public ResourceIdentifier PrivateEndpointId
{
get => PrivateEndpoint is null ? default : PrivateEndpoint.Id;
@@ -89,8 +90,10 @@ public ResourceIdentifier PrivateEndpointId
}
/// Connection state of the private endpoint connection.
+ [WirePath("properties.privateLinkServiceConnectionState")]
public MySqlPrivateLinkServiceConnectionStateProperty ConnectionState { get; set; }
/// State of the private endpoint connection.
+ [WirePath("properties.provisioningState")]
public string ProvisioningState { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.Serialization.cs
index f0600c853b908..6bfbfe8b7cd6d 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql.Models;
@@ -148,6 +150,127 @@ internal static MySqlPrivateLinkResourceData DeserializeMySqlPrivateLinkResource
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride);
+ if (Optional.IsDefined(Properties) || hasPropertyOverride)
+ {
+ builder.Append(" properties: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, Properties, options, 2, false, " properties: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -156,6 +279,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrit
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlPrivateLinkResourceData)} does not support '{options.Format}' format.");
}
@@ -172,6 +297,8 @@ MySqlPrivateLinkResourceData IPersistableModel.Cre
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlPrivateLinkResourceData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlPrivateLinkResourceData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.cs
index 2b097f983288a..9bce7660f1ee4 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResourceData.cs
@@ -70,6 +70,7 @@ internal MySqlPrivateLinkResourceData(ResourceIdentifier id, string name, Resour
}
/// The private link resource group id.
+ [WirePath("properties")]
public MySqlPrivateLinkResourceProperties Properties { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.Serialization.cs
index 6b5cf54c6d869..da2576e6c9f67 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -296,6 +299,319 @@ internal static MySqlQueryStatisticData DeserializeMySqlQueryStatisticData(JsonE
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryId), out propertyOverride);
+ if (Optional.IsDefined(QueryId) || hasPropertyOverride)
+ {
+ builder.Append(" queryId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (QueryId.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{QueryId}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{QueryId}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride);
+ if (Optional.IsDefined(StartOn) || hasPropertyOverride)
+ {
+ builder.Append(" startTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride);
+ if (Optional.IsDefined(EndOn) || hasPropertyOverride)
+ {
+ builder.Append(" endTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AggregationFunction), out propertyOverride);
+ if (Optional.IsDefined(AggregationFunction) || hasPropertyOverride)
+ {
+ builder.Append(" aggregationFunction: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (AggregationFunction.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{AggregationFunction}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{AggregationFunction}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DatabaseNames), out propertyOverride);
+ if (Optional.IsCollectionDefined(DatabaseNames) || hasPropertyOverride)
+ {
+ if (DatabaseNames.Any() || hasPropertyOverride)
+ {
+ builder.Append(" databaseNames: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in DatabaseNames)
+ {
+ if (item == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Contains(Environment.NewLine))
+ {
+ builder.AppendLine(" '''");
+ builder.AppendLine($"{item}'''");
+ }
+ else
+ {
+ builder.AppendLine($" '{item}'");
+ }
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryExecutionCount), out propertyOverride);
+ if (Optional.IsDefined(QueryExecutionCount) || hasPropertyOverride)
+ {
+ builder.Append(" queryExecutionCount: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{QueryExecutionCount.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MetricName), out propertyOverride);
+ if (Optional.IsDefined(MetricName) || hasPropertyOverride)
+ {
+ builder.Append(" metricName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (MetricName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{MetricName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{MetricName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MetricDisplayName), out propertyOverride);
+ if (Optional.IsDefined(MetricDisplayName) || hasPropertyOverride)
+ {
+ builder.Append(" metricDisplayName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (MetricDisplayName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{MetricDisplayName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{MetricDisplayName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MetricValue), out propertyOverride);
+ if (Optional.IsDefined(MetricValue) || hasPropertyOverride)
+ {
+ builder.Append(" metricValue: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{MetricValue.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MetricValueUnit), out propertyOverride);
+ if (Optional.IsDefined(MetricValueUnit) || hasPropertyOverride)
+ {
+ builder.Append(" metricValueUnit: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (MetricValueUnit.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{MetricValueUnit}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{MetricValueUnit}'");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -304,6 +620,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlQueryStatisticData)} does not support '{options.Format}' format.");
}
@@ -320,6 +638,8 @@ MySqlQueryStatisticData IPersistableModel.Create(Binary
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlQueryStatisticData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlQueryStatisticData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.cs
index 896a2982b954d..b02cc2581918d 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticData.cs
@@ -88,24 +88,34 @@ internal MySqlQueryStatisticData(ResourceIdentifier id, string name, ResourceTyp
}
/// Database query identifier.
+ [WirePath("properties.queryId")]
public string QueryId { get; set; }
/// Observation start time.
+ [WirePath("properties.startTime")]
public DateTimeOffset? StartOn { get; set; }
/// Observation end time.
+ [WirePath("properties.endTime")]
public DateTimeOffset? EndOn { get; set; }
/// Aggregation function name.
+ [WirePath("properties.aggregationFunction")]
public string AggregationFunction { get; set; }
/// The list of database names.
+ [WirePath("properties.databaseNames")]
public IList DatabaseNames { get; }
/// Number of query executions in this time interval.
+ [WirePath("properties.queryExecutionCount")]
public long? QueryExecutionCount { get; set; }
/// Metric name.
+ [WirePath("properties.metricName")]
public string MetricName { get; set; }
/// Metric display name.
+ [WirePath("properties.metricDisplayName")]
public string MetricDisplayName { get; set; }
/// Metric value.
+ [WirePath("properties.metricValue")]
public double? MetricValue { get; set; }
/// Metric value unit.
+ [WirePath("properties.metricValueUnit")]
public string MetricValueUnit { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.Serialization.cs
index 29aae27e2cbe2..124fb4d2e93dc 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -170,6 +172,160 @@ internal static MySqlQueryTextData DeserializeMySqlQueryTextData(JsonElement ele
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryId), out propertyOverride);
+ if (Optional.IsDefined(QueryId) || hasPropertyOverride)
+ {
+ builder.Append(" queryId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (QueryId.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{QueryId}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{QueryId}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryText), out propertyOverride);
+ if (Optional.IsDefined(QueryText) || hasPropertyOverride)
+ {
+ builder.Append(" queryText: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (QueryText.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{QueryText}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{QueryText}'");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -178,6 +334,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlQueryTextData)} does not support '{options.Format}' format.");
}
@@ -194,6 +352,8 @@ MySqlQueryTextData IPersistableModel.Create(BinaryData data,
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlQueryTextData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlQueryTextData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.cs
index b4543723b1407..343b6becf6060 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextData.cs
@@ -71,8 +71,10 @@ internal MySqlQueryTextData(ResourceIdentifier id, string name, ResourceType res
}
/// Query identifier unique to the server.
+ [WirePath("properties.queryId")]
public string QueryId { get; set; }
/// Query text.
+ [WirePath("properties.queryText")]
public string QueryText { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.Serialization.cs
index d6da55cb548c5..1e18aa88b5fc6 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -273,6 +276,276 @@ internal static MySqlRecommendationActionData DeserializeMySqlRecommendationActi
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdvisorName), out propertyOverride);
+ if (Optional.IsDefined(AdvisorName) || hasPropertyOverride)
+ {
+ builder.Append(" advisorName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (AdvisorName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{AdvisorName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{AdvisorName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionId), out propertyOverride);
+ if (Optional.IsDefined(SessionId) || hasPropertyOverride)
+ {
+ builder.Append(" sessionId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SessionId.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionId), out propertyOverride);
+ if (Optional.IsDefined(ActionId) || hasPropertyOverride)
+ {
+ builder.Append(" actionId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{ActionId.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreatedOn), out propertyOverride);
+ if (Optional.IsDefined(CreatedOn) || hasPropertyOverride)
+ {
+ builder.Append(" createdTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(CreatedOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExpireOn), out propertyOverride);
+ if (Optional.IsDefined(ExpireOn) || hasPropertyOverride)
+ {
+ builder.Append(" expirationTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(ExpireOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Reason), out propertyOverride);
+ if (Optional.IsDefined(Reason) || hasPropertyOverride)
+ {
+ builder.Append(" reason: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Reason.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Reason}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Reason}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RecommendationType), out propertyOverride);
+ if (Optional.IsDefined(RecommendationType) || hasPropertyOverride)
+ {
+ builder.Append(" recommendationType: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (RecommendationType.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{RecommendationType}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{RecommendationType}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Details), out propertyOverride);
+ if (Optional.IsCollectionDefined(Details) || hasPropertyOverride)
+ {
+ if (Details.Any() || hasPropertyOverride)
+ {
+ builder.Append(" details: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("{");
+ foreach (var item in Details)
+ {
+ builder.Append($" '{item.Key}': ");
+ if (item.Value == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Value.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{item.Value}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{item.Value}'");
+ }
+ }
+ builder.AppendLine(" }");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -281,6 +554,8 @@ BinaryData IPersistableModel.Write(ModelReaderWri
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlRecommendationActionData)} does not support '{options.Format}' format.");
}
@@ -297,6 +572,8 @@ MySqlRecommendationActionData IPersistableModel.C
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlRecommendationActionData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlRecommendationActionData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.cs
index fce95cc4759e1..1a0e04c00ee80 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionData.cs
@@ -84,20 +84,28 @@ internal MySqlRecommendationActionData(ResourceIdentifier id, string name, Resou
}
/// Advisor name.
+ [WirePath("properties.advisorName")]
public string AdvisorName { get; set; }
/// Recommendation action session identifier.
+ [WirePath("properties.sessionId")]
public Guid? SessionId { get; set; }
/// Recommendation action identifier.
+ [WirePath("properties.actionId")]
public int? ActionId { get; set; }
/// Recommendation action creation time.
+ [WirePath("properties.createdTime")]
public DateTimeOffset? CreatedOn { get; set; }
/// Recommendation action expiration time.
+ [WirePath("properties.expirationTime")]
public DateTimeOffset? ExpireOn { get; set; }
/// Recommendation action reason.
+ [WirePath("properties.reason")]
public string Reason { get; set; }
/// Recommendation action type.
+ [WirePath("properties.recommendationType")]
public string RecommendationType { get; set; }
/// Recommendation action details.
+ [WirePath("properties.details")]
public IDictionary Details { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.Serialization.cs
index 91bf9e7dd8ca4..e9bea2d37090d 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql.Models;
@@ -207,6 +209,180 @@ internal static MySqlServerAdministratorData DeserializeMySqlServerAdministrator
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdministratorType), out propertyOverride);
+ if (Optional.IsDefined(AdministratorType) || hasPropertyOverride)
+ {
+ builder.Append(" administratorType: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{AdministratorType.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LoginAccountName), out propertyOverride);
+ if (Optional.IsDefined(LoginAccountName) || hasPropertyOverride)
+ {
+ builder.Append(" login: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (LoginAccountName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{LoginAccountName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{LoginAccountName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecureId), out propertyOverride);
+ if (Optional.IsDefined(SecureId) || hasPropertyOverride)
+ {
+ builder.Append(" sid: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SecureId.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TenantId), out propertyOverride);
+ if (Optional.IsDefined(TenantId) || hasPropertyOverride)
+ {
+ builder.Append(" tenantId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{TenantId.Value.ToString()}'");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -215,6 +391,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrit
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerAdministratorData)} does not support '{options.Format}' format.");
}
@@ -231,6 +409,8 @@ MySqlServerAdministratorData IPersistableModel.Cre
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlServerAdministratorData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlServerAdministratorData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.cs
index 42dd0532001db..ef59db027066c 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorData.cs
@@ -76,12 +76,16 @@ internal MySqlServerAdministratorData(ResourceIdentifier id, string name, Resour
}
/// The type of administrator.
+ [WirePath("properties.administratorType")]
public MySqlAdministratorType? AdministratorType { get; set; }
/// The server administrator login account name.
+ [WirePath("properties.login")]
public string LoginAccountName { get; set; }
/// The server administrator Sid (Secure ID).
+ [WirePath("properties.sid")]
public Guid? SecureId { get; set; }
/// The server Active Directory Administrator tenant id.
+ [WirePath("properties.tenantId")]
public Guid? TenantId { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.Serialization.cs
index 977f5542d6e19..cfc868cacee4e 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.Serialization.cs
@@ -7,8 +7,12 @@
using System;
using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql.Models;
namespace Azure.ResourceManager.MySql
@@ -182,6 +186,442 @@ MySqlServerData IJsonModel.Create(ref Utf8JsonReader reader, Mo
return DeserializeMySqlServerData(document.RootElement, options);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride);
+ builder.Append(" location: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Location.ToString()}'");
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride);
+ if (Optional.IsCollectionDefined(Tags) || hasPropertyOverride)
+ {
+ if (Tags.Any() || hasPropertyOverride)
+ {
+ builder.Append(" tags: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("{");
+ foreach (var item in Tags)
+ {
+ builder.Append($" '{item.Key}': ");
+ if (item.Value == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Value.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{item.Value}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{item.Value}'");
+ }
+ }
+ builder.AppendLine(" }");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride);
+ if (Optional.IsDefined(Identity) || hasPropertyOverride)
+ {
+ builder.Append(" identity: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, Identity, options, 2, false, " identity: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride);
+ if (Optional.IsDefined(Sku) || hasPropertyOverride)
+ {
+ builder.Append(" sku: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, Sku, options, 2, false, " sku: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdministratorLogin), out propertyOverride);
+ if (Optional.IsDefined(AdministratorLogin) || hasPropertyOverride)
+ {
+ builder.Append(" administratorLogin: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (AdministratorLogin.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{AdministratorLogin}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{AdministratorLogin}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride);
+ if (Optional.IsDefined(Version) || hasPropertyOverride)
+ {
+ builder.Append(" version: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Version.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SslEnforcement), out propertyOverride);
+ if (Optional.IsDefined(SslEnforcement) || hasPropertyOverride)
+ {
+ builder.Append(" sslEnforcement: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SslEnforcement.Value.ToSerialString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinimalTlsVersion), out propertyOverride);
+ if (Optional.IsDefined(MinimalTlsVersion) || hasPropertyOverride)
+ {
+ builder.Append(" minimalTlsVersion: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{MinimalTlsVersion.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ByokEnforcement), out propertyOverride);
+ if (Optional.IsDefined(ByokEnforcement) || hasPropertyOverride)
+ {
+ builder.Append(" byokEnforcement: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (ByokEnforcement.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ByokEnforcement}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ByokEnforcement}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InfrastructureEncryption), out propertyOverride);
+ if (Optional.IsDefined(InfrastructureEncryption) || hasPropertyOverride)
+ {
+ builder.Append(" infrastructureEncryption: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{InfrastructureEncryption.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserVisibleState), out propertyOverride);
+ if (Optional.IsDefined(UserVisibleState) || hasPropertyOverride)
+ {
+ builder.Append(" userVisibleState: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{UserVisibleState.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FullyQualifiedDomainName), out propertyOverride);
+ if (Optional.IsDefined(FullyQualifiedDomainName) || hasPropertyOverride)
+ {
+ builder.Append(" fullyQualifiedDomainName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (FullyQualifiedDomainName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{FullyQualifiedDomainName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{FullyQualifiedDomainName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EarliestRestoreOn), out propertyOverride);
+ if (Optional.IsDefined(EarliestRestoreOn) || hasPropertyOverride)
+ {
+ builder.Append(" earliestRestoreDate: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(EarliestRestoreOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageProfile), out propertyOverride);
+ if (Optional.IsDefined(StorageProfile) || hasPropertyOverride)
+ {
+ builder.Append(" storageProfile: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ AppendChildObject(builder, StorageProfile, options, 4, false, " storageProfile: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicationRole), out propertyOverride);
+ if (Optional.IsDefined(ReplicationRole) || hasPropertyOverride)
+ {
+ builder.Append(" replicationRole: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (ReplicationRole.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ReplicationRole}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ReplicationRole}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MasterServerId), out propertyOverride);
+ if (Optional.IsDefined(MasterServerId) || hasPropertyOverride)
+ {
+ builder.Append(" masterServerId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{MasterServerId.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicaCapacity), out propertyOverride);
+ if (Optional.IsDefined(ReplicaCapacity) || hasPropertyOverride)
+ {
+ builder.Append(" replicaCapacity: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{ReplicaCapacity.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride);
+ if (Optional.IsDefined(PublicNetworkAccess) || hasPropertyOverride)
+ {
+ builder.Append(" publicNetworkAccess: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{PublicNetworkAccess.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpointConnections), out propertyOverride);
+ if (Optional.IsCollectionDefined(PrivateEndpointConnections) || hasPropertyOverride)
+ {
+ if (PrivateEndpointConnections.Any() || hasPropertyOverride)
+ {
+ builder.Append(" privateEndpointConnections: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in PrivateEndpointConnections)
+ {
+ AppendChildObject(builder, item, options, 6, true, " privateEndpointConnections: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -190,6 +630,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerData)} does not support '{options.Format}' format.");
}
@@ -206,6 +648,8 @@ MySqlServerData IPersistableModel.Create(BinaryData data, Model
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlServerData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlServerData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.cs
index 6fbf6ead5c07c..2ca33ee8ba2a2 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerData.cs
@@ -111,38 +111,55 @@ internal MySqlServerData()
}
/// The Azure Active Directory identity of the server. Current supported identity types: SystemAssigned.
+ [WirePath("identity")]
public ManagedServiceIdentity Identity { get; set; }
/// The SKU (pricing tier) of the server.
+ [WirePath("sku")]
public MySqlSku Sku { get; set; }
/// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
+ [WirePath("properties.administratorLogin")]
public string AdministratorLogin { get; set; }
/// Server version.
+ [WirePath("properties.version")]
public MySqlServerVersion? Version { get; set; }
/// Enable ssl enforcement or not when connect to server.
+ [WirePath("properties.sslEnforcement")]
public MySqlSslEnforcementEnum? SslEnforcement { get; set; }
/// Enforce a minimal Tls version for the server.
+ [WirePath("properties.minimalTlsVersion")]
public MySqlMinimalTlsVersionEnum? MinimalTlsVersion { get; set; }
/// Status showing whether the server data encryption is enabled with customer-managed keys.
+ [WirePath("properties.byokEnforcement")]
public string ByokEnforcement { get; }
/// Status showing whether the server enabled infrastructure encryption.
+ [WirePath("properties.infrastructureEncryption")]
public MySqlInfrastructureEncryption? InfrastructureEncryption { get; set; }
/// A state of a server that is visible to user.
+ [WirePath("properties.userVisibleState")]
public MySqlServerState? UserVisibleState { get; set; }
/// The fully qualified domain name of a server.
+ [WirePath("properties.fullyQualifiedDomainName")]
public string FullyQualifiedDomainName { get; set; }
/// Earliest restore point creation time (ISO8601 format).
+ [WirePath("properties.earliestRestoreDate")]
public DateTimeOffset? EarliestRestoreOn { get; set; }
/// Storage profile of a server.
+ [WirePath("properties.storageProfile")]
public MySqlStorageProfile StorageProfile { get; set; }
/// The replication role of the server.
+ [WirePath("properties.replicationRole")]
public string ReplicationRole { get; set; }
/// The master server id of a replica server.
+ [WirePath("properties.masterServerId")]
public ResourceIdentifier MasterServerId { get; set; }
/// The maximum number of replicas that a master server can have.
+ [WirePath("properties.replicaCapacity")]
public int? ReplicaCapacity { get; set; }
/// Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'.
+ [WirePath("properties.publicNetworkAccess")]
public MySqlPublicNetworkAccessEnum? PublicNetworkAccess { get; set; }
/// List of private endpoint connections on a server.
+ [WirePath("properties.privateEndpointConnections")]
public IReadOnlyList PrivateEndpointConnections { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.Serialization.cs
index 8dd5170da24a9..5d26e712b3144 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql.Models;
@@ -207,6 +209,181 @@ internal static MySqlServerKeyData DeserializeMySqlServerKeyData(JsonElement ele
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride);
+ if (Optional.IsDefined(Kind) || hasPropertyOverride)
+ {
+ builder.Append(" kind: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Kind.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Kind}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Kind}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServerKeyType), out propertyOverride);
+ if (Optional.IsDefined(ServerKeyType) || hasPropertyOverride)
+ {
+ builder.Append(" serverKeyType: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{ServerKeyType.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uri), out propertyOverride);
+ if (Optional.IsDefined(Uri) || hasPropertyOverride)
+ {
+ builder.Append(" uri: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Uri.AbsoluteUri}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreatedOn), out propertyOverride);
+ if (Optional.IsDefined(CreatedOn) || hasPropertyOverride)
+ {
+ builder.Append(" creationDate: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(CreatedOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -215,6 +392,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerKeyData)} does not support '{options.Format}' format.");
}
@@ -231,6 +410,8 @@ MySqlServerKeyData IPersistableModel.Create(BinaryData data,
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlServerKeyData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlServerKeyData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.cs
index 25940da0be8b3..00fa83160ae2c 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyData.cs
@@ -76,12 +76,16 @@ internal MySqlServerKeyData(ResourceIdentifier id, string name, ResourceType res
}
/// Kind of encryption protector used to protect the key.
+ [WirePath("kind")]
public string Kind { get; }
/// The key type like 'AzureKeyVault'.
+ [WirePath("properties.serverKeyType")]
public MySqlServerKeyType? ServerKeyType { get; set; }
/// The URI of the key.
+ [WirePath("properties.uri")]
public Uri Uri { get; set; }
/// The key creation date.
+ [WirePath("properties.creationDate")]
public DateTimeOffset? CreatedOn { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyData.Serialization.cs
index d116462b15cfa..aa664de22f22c 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyData.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql.Models;
@@ -271,6 +274,273 @@ internal static MySqlServerSecurityAlertPolicyData DeserializeMySqlServerSecurit
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride);
+ if (Optional.IsDefined(State) || hasPropertyOverride)
+ {
+ builder.Append(" state: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{State.Value.ToSerialString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisabledAlerts), out propertyOverride);
+ if (Optional.IsCollectionDefined(DisabledAlerts) || hasPropertyOverride)
+ {
+ if (DisabledAlerts.Any() || hasPropertyOverride)
+ {
+ builder.Append(" disabledAlerts: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in DisabledAlerts)
+ {
+ if (item == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Contains(Environment.NewLine))
+ {
+ builder.AppendLine(" '''");
+ builder.AppendLine($"{item}'''");
+ }
+ else
+ {
+ builder.AppendLine($" '{item}'");
+ }
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EmailAddresses), out propertyOverride);
+ if (Optional.IsCollectionDefined(EmailAddresses) || hasPropertyOverride)
+ {
+ if (EmailAddresses.Any() || hasPropertyOverride)
+ {
+ builder.Append(" emailAddresses: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine("[");
+ foreach (var item in EmailAddresses)
+ {
+ if (item == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Contains(Environment.NewLine))
+ {
+ builder.AppendLine(" '''");
+ builder.AppendLine($"{item}'''");
+ }
+ else
+ {
+ builder.AppendLine($" '{item}'");
+ }
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SendToEmailAccountAdmins), out propertyOverride);
+ if (Optional.IsDefined(SendToEmailAccountAdmins) || hasPropertyOverride)
+ {
+ builder.Append(" emailAccountAdmins: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var boolValue = SendToEmailAccountAdmins.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageEndpoint), out propertyOverride);
+ if (Optional.IsDefined(StorageEndpoint) || hasPropertyOverride)
+ {
+ builder.Append(" storageEndpoint: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (StorageEndpoint.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{StorageEndpoint}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{StorageEndpoint}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageAccountAccessKey), out propertyOverride);
+ if (Optional.IsDefined(StorageAccountAccessKey) || hasPropertyOverride)
+ {
+ builder.Append(" storageAccountAccessKey: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (StorageAccountAccessKey.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{StorageAccountAccessKey}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{StorageAccountAccessKey}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RetentionDays), out propertyOverride);
+ if (Optional.IsDefined(RetentionDays) || hasPropertyOverride)
+ {
+ builder.Append(" retentionDays: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"{RetentionDays.Value}");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -279,6 +549,8 @@ BinaryData IPersistableModel.Write(ModelRead
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlServerSecurityAlertPolicyData)} does not support '{options.Format}' format.");
}
@@ -295,6 +567,8 @@ MySqlServerSecurityAlertPolicyData IPersistableModel Specifies the state of the policy, whether it is enabled or disabled.
+ [WirePath("properties.state")]
public MySqlServerSecurityAlertPolicyState? State { get; set; }
/// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly.
+ [WirePath("properties.disabledAlerts")]
public IList DisabledAlerts { get; }
/// Specifies an array of e-mail addresses to which the alert is sent.
+ [WirePath("properties.emailAddresses")]
public IList EmailAddresses { get; }
/// Specifies that the alert is sent to the account administrators.
+ [WirePath("properties.emailAccountAdmins")]
public bool? SendToEmailAccountAdmins { get; set; }
/// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
+ [WirePath("properties.storageEndpoint")]
public string StorageEndpoint { get; set; }
/// Specifies the identifier key of the Threat Detection audit storage account.
+ [WirePath("properties.storageAccountAccessKey")]
public string StorageAccountAccessKey { get; set; }
/// Specifies the number of days to keep in the Threat Detection audit logs.
+ [WirePath("properties.retentionDays")]
public int? RetentionDays { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.Serialization.cs
index 4f08d26858a97..a86469316de51 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.MySql.Models;
@@ -195,6 +197,159 @@ internal static MySqlVirtualNetworkRuleData DeserializeMySqlVirtualNetworkRuleDa
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualNetworkSubnetId), out propertyOverride);
+ if (Optional.IsDefined(VirtualNetworkSubnetId) || hasPropertyOverride)
+ {
+ builder.Append(" virtualNetworkSubnetId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{VirtualNetworkSubnetId.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IgnoreMissingVnetServiceEndpoint), out propertyOverride);
+ if (Optional.IsDefined(IgnoreMissingVnetServiceEndpoint) || hasPropertyOverride)
+ {
+ builder.Append(" ignoreMissingVnetServiceEndpoint: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var boolValue = IgnoreMissingVnetServiceEndpoint.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride);
+ if (Optional.IsDefined(State) || hasPropertyOverride)
+ {
+ builder.Append(" state: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{State.Value.ToString()}'");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -203,6 +358,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrite
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlVirtualNetworkRuleData)} does not support '{options.Format}' format.");
}
@@ -219,6 +376,8 @@ MySqlVirtualNetworkRuleData IPersistableModel.Creat
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlVirtualNetworkRuleData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlVirtualNetworkRuleData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.cs
index c343b96f581e6..4102dd3a8dcf9 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleData.cs
@@ -74,10 +74,13 @@ internal MySqlVirtualNetworkRuleData(ResourceIdentifier id, string name, Resourc
}
/// The ARM resource id of the virtual network subnet.
+ [WirePath("properties.virtualNetworkSubnetId")]
public ResourceIdentifier VirtualNetworkSubnetId { get; set; }
/// Create firewall rule before the virtual network has vnet service endpoint enabled.
+ [WirePath("properties.ignoreMissingVnetServiceEndpoint")]
public bool? IgnoreMissingVnetServiceEndpoint { get; set; }
/// Virtual Network Rule State.
+ [WirePath("properties.state")]
public MySqlVirtualNetworkRuleState? State { get; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.Serialization.cs
index 30cea20ba354d..eeaf89833f2b1 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.Serialization.cs
@@ -8,8 +8,10 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.MySql
@@ -278,6 +280,268 @@ internal static MySqlWaitStatisticData DeserializeMySqlWaitStatisticData(JsonEle
serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.ParameterOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (Optional.IsDefined(Name) || hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (Optional.IsDefined(Id) || hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (Optional.IsDefined(SystemData) || hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride);
+ if (Optional.IsDefined(StartOn) || hasPropertyOverride)
+ {
+ builder.Append(" startTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride);
+ if (Optional.IsDefined(EndOn) || hasPropertyOverride)
+ {
+ builder.Append(" endTime: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o");
+ builder.AppendLine($"'{formattedDateTimeString}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EventName), out propertyOverride);
+ if (Optional.IsDefined(EventName) || hasPropertyOverride)
+ {
+ builder.Append(" eventName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (EventName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{EventName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{EventName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EventTypeName), out propertyOverride);
+ if (Optional.IsDefined(EventTypeName) || hasPropertyOverride)
+ {
+ builder.Append(" eventTypeName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (EventTypeName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{EventTypeName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{EventTypeName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryId), out propertyOverride);
+ if (Optional.IsDefined(QueryId) || hasPropertyOverride)
+ {
+ builder.Append(" queryId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{QueryId.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DatabaseName), out propertyOverride);
+ if (Optional.IsDefined(DatabaseName) || hasPropertyOverride)
+ {
+ builder.Append(" databaseName: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ if (DatabaseName.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{DatabaseName}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{DatabaseName}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserId), out propertyOverride);
+ if (Optional.IsDefined(UserId) || hasPropertyOverride)
+ {
+ builder.Append(" userId: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{UserId.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Count), out propertyOverride);
+ if (Optional.IsDefined(Count) || hasPropertyOverride)
+ {
+ builder.Append(" count: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{Count.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TotalTimeInMinutes), out propertyOverride);
+ if (Optional.IsDefined(TotalTimeInMinutes) || hasPropertyOverride)
+ {
+ builder.Append(" totalTimeInMs: ");
+ if (hasPropertyOverride)
+ {
+ builder.AppendLine($"{propertyOverride}");
+ }
+ else
+ {
+ builder.AppendLine($"'{TotalTimeInMinutes.Value.ToString()}'");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ private void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
+ {
+ string indent = new string(' ', spaces);
+ int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
+ int length = stringBuilder.Length;
+ bool inMultilineString = false;
+
+ BinaryData data = ModelReaderWriter.Write(childObject, options);
+ string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ string line = lines[i];
+ if (inMultilineString)
+ {
+ if (line.Contains("'''"))
+ {
+ inMultilineString = false;
+ }
+ stringBuilder.AppendLine(line);
+ continue;
+ }
+ if (line.Contains("'''"))
+ {
+ inMultilineString = true;
+ stringBuilder.AppendLine($"{indent}{line}");
+ continue;
+ }
+ if (i == 0 && !indentFirstLine)
+ {
+ stringBuilder.AppendLine($"{line}");
+ }
+ else
+ {
+ stringBuilder.AppendLine($"{indent}{line}");
+ }
+ }
+ if (stringBuilder.Length == length + emptyObjectLength)
+ {
+ stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
+ }
+ }
+
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
@@ -286,6 +550,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti
{
case "J":
return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(MySqlWaitStatisticData)} does not support '{options.Format}' format.");
}
@@ -302,6 +568,8 @@ MySqlWaitStatisticData IPersistableModel.Create(BinaryDa
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeMySqlWaitStatisticData(document.RootElement, options);
}
+ case "bicep":
+ throw new InvalidOperationException("Bicep deserialization is not supported for this type.");
default:
throw new FormatException($"The model {nameof(MySqlWaitStatisticData)} does not support '{options.Format}' format.");
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.cs
index dba5ebd38a3a1..49c476f41ead2 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticData.cs
@@ -85,22 +85,31 @@ internal MySqlWaitStatisticData(ResourceIdentifier id, string name, ResourceType
}
/// Observation start time.
+ [WirePath("properties.startTime")]
public DateTimeOffset? StartOn { get; set; }
/// Observation end time.
+ [WirePath("properties.endTime")]
public DateTimeOffset? EndOn { get; set; }
/// Wait event name.
+ [WirePath("properties.eventName")]
public string EventName { get; set; }
/// Wait event type name.
+ [WirePath("properties.eventTypeName")]
public string EventTypeName { get; set; }
/// Database query identifier.
+ [WirePath("properties.queryId")]
public long? QueryId { get; set; }
/// Database Name.
+ [WirePath("properties.databaseName")]
public string DatabaseName { get; set; }
/// Database user identifier.
+ [WirePath("properties.userId")]
public long? UserId { get; set; }
/// Wait event count observed in this time interval.
+ [WirePath("properties.count")]
public long? Count { get; set; }
/// Total time of wait in milliseconds in this time interval.
+ [WirePath("properties.totalTimeInMs")]
public double? TotalTimeInMinutes { get; set; }
}
}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Internal/WirePathAttribute.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Internal/WirePathAttribute.cs
new file mode 100644
index 0000000000000..ed623904d5da7
--- /dev/null
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Internal/WirePathAttribute.cs
@@ -0,0 +1,27 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.MySql.FlexibleServers
+{
+ [AttributeUsage(AttributeTargets.Property)]
+ internal class WirePathAttribute : Attribute
+ {
+ private string _wirePath;
+
+ public WirePathAttribute(string wirePath)
+ {
+ _wirePath = wirePath;
+ }
+
+ public override string ToString()
+ {
+ return _wirePath;
+ }
+ }
+}
diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs
index 394f699d35060..15bfbb1da0504 100644
--- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs
+++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs
@@ -8,8 +8,11 @@
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Text.Json;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
using Azure.ResourceManager.MySql.FlexibleServers;
@@ -115,6 +118,107 @@ internal static CapabilitySetsList DeserializeCapabilitySetsList(JsonElement ele
return new CapabilitySetsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
}
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary