Files
dotnet__skills/tests/dotnet-upgrade/dotnet-aot-compat/before/ManagementGroup/Generated/ManagementGroupSubscriptionData.Serialization.cs
Dan Moseley 042a9d2b2c Reorganize plugins into domain-specific groupings (#274)
* Reorganize plugins per agreed structure (#271)

Split the dotnet plugin into domain-specific plugins per discussion
in #271:

- dotnet: narrowed to common everyday C#/.NET coding tasks
- dotnet-diag: perf investigations, debugging, incident analysis
- dotnet-data: data access and Entity Framework
- dotnet-aspnet, dotnet-wpf, dotnet-winforms, dotnet-maui: scaffolded
  empty to convey intent for future framework-specific skills

Moved skills, tests, and CODEOWNERS entries accordingly.
No file content was changed; all skill/test moves are pure renames.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Improve dotnet-diag and dotnet-winforms descriptions

- dotnet-diag: add '.NET' qualifier to clarify scope
- dotnet-winforms: use official 'Windows Forms (WinForms)' name

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add .NET qualifier to dotnet-data description

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove empty plugins; list them in CONTRIBUTING.md as future options

Remove the four empty placeholder plugins (dotnet-aspnet, dotnet-wpf,
dotnet-winforms, dotnet-maui) that had only plugin.json and no skills.

Add a 'Plugin organization' section to CONTRIBUTING.md that describes the
domain-specific plugin groupings introduced in this PR and lists the four
removed plugin names as reserved candidates for future contributions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Create dotnet-upgrade plugin with migration/upgrade skills

Move migrate-nullable-references, thread-abort-migration, and
dotnet-aot-compat from dotnet to the new dotnet-upgrade plugin.

Update CODEOWNERS paths (same owners), CONTRIBUTING.md plugin table,
and fix the thread-abort-migration SKILL.md link in CONTRIBUTING.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 21:01:52 -08:00

378 lines
15 KiB
C#

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using Azure.Core;
using Azure.ResourceManager.ManagementGroups.Models;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.ManagementGroups
{
public partial class ManagementGroupSubscriptionData : IUtf8JsonSerializable, IJsonModel<ManagementGroupSubscriptionData>
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel<ManagementGroupSubscriptionData>)this).Write(writer, ModelSerializationExtensions.WireOptions);
void IJsonModel<ManagementGroupSubscriptionData>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
JsonModelWriteCore(writer, options);
writer.WriteEndObject();
}
/// <param name="writer"> The JSON writer. </param>
/// <param name="options"> The client options for reading and writing models. </param>
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel<ManagementGroupSubscriptionData>)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(ManagementGroupSubscriptionData)} does not support writing '{format}' format.");
}
base.JsonModelWriteCore(writer, options);
writer.WritePropertyName("properties"u8);
writer.WriteStartObject();
if (Optional.IsDefined(Tenant))
{
writer.WritePropertyName("tenant"u8);
writer.WriteStringValue(Tenant);
}
if (Optional.IsDefined(DisplayName))
{
writer.WritePropertyName("displayName"u8);
writer.WriteStringValue(DisplayName);
}
if (Optional.IsDefined(Parent))
{
if (Parent != null)
{
writer.WritePropertyName("parent"u8);
writer.WriteObjectValue(Parent, options);
}
else
{
writer.WriteNull("parent");
}
}
if (Optional.IsDefined(State))
{
writer.WritePropertyName("state"u8);
writer.WriteStringValue(State);
}
writer.WriteEndObject();
}
ManagementGroupSubscriptionData IJsonModel<ManagementGroupSubscriptionData>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel<ManagementGroupSubscriptionData>)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(ManagementGroupSubscriptionData)} does not support reading '{format}' format.");
}
using JsonDocument document = JsonDocument.ParseValue(ref reader);
return DeserializeManagementGroupSubscriptionData(document.RootElement, options);
}
internal static ManagementGroupSubscriptionData DeserializeManagementGroupSubscriptionData(JsonElement element, ModelReaderWriterOptions options = null)
{
options ??= ModelSerializationExtensions.WireOptions;
if (element.ValueKind == JsonValueKind.Null)
{
return null;
}
ResourceIdentifier id = default;
string name = default;
ResourceType type = default;
SystemData systemData = default;
string tenant = default;
string displayName = default;
DescendantParentGroupInfo parent = default;
string state = default;
IDictionary<string, BinaryData> serializedAdditionalRawData = default;
Dictionary<string, BinaryData> rawDataDictionary = new Dictionary<string, BinaryData>();
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("id"u8))
{
id = new ResourceIdentifier(property.Value.GetString());
continue;
}
if (property.NameEquals("name"u8))
{
name = property.Value.GetString();
continue;
}
if (property.NameEquals("type"u8))
{
type = new ResourceType(property.Value.GetString());
continue;
}
if (property.NameEquals("systemData"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
systemData = JsonSerializer.Deserialize<SystemData>(property.Value.GetRawText());
continue;
}
if (property.NameEquals("properties"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}
foreach (var property0 in property.Value.EnumerateObject())
{
if (property0.NameEquals("tenant"u8))
{
tenant = property0.Value.GetString();
continue;
}
if (property0.NameEquals("displayName"u8))
{
displayName = property0.Value.GetString();
continue;
}
if (property0.NameEquals("parent"u8))
{
if (property0.Value.ValueKind == JsonValueKind.Null)
{
parent = null;
continue;
}
parent = DescendantParentGroupInfo.DeserializeDescendantParentGroupInfo(property0.Value, options);
continue;
}
if (property0.NameEquals("state"u8))
{
state = property0.Value.GetString();
continue;
}
}
continue;
}
if (options.Format != "W")
{
rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
}
}
serializedAdditionalRawData = rawDataDictionary;
return new ManagementGroupSubscriptionData(
id,
name,
type,
systemData,
tenant,
displayName,
parent,
state,
serializedAdditionalRawData);
}
private BinaryData SerializeBicep(ModelReaderWriterOptions options)
{
StringBuilder builder = new StringBuilder();
BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
IDictionary<string, string> propertyOverrides = null;
bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
bool hasPropertyOverride = false;
string propertyOverride = null;
builder.AppendLine("{");
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" name: ");
builder.AppendLine(propertyOverride);
}
else
{
if (Optional.IsDefined(Name))
{
builder.Append(" name: ");
if (Name.Contains(Environment.NewLine))
{
builder.AppendLine("'''");
builder.AppendLine($"{Name}'''");
}
else
{
builder.AppendLine($"'{Name}'");
}
}
}
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" id: ");
builder.AppendLine(propertyOverride);
}
else
{
if (Optional.IsDefined(Id))
{
builder.Append(" id: ");
builder.AppendLine($"'{Id.ToString()}'");
}
}
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" systemData: ");
builder.AppendLine(propertyOverride);
}
else
{
if (Optional.IsDefined(SystemData))
{
builder.Append(" systemData: ");
builder.AppendLine($"'{SystemData.ToString()}'");
}
}
builder.Append(" properties:");
builder.AppendLine(" {");
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tenant), out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" tenant: ");
builder.AppendLine(propertyOverride);
}
else
{
if (Optional.IsDefined(Tenant))
{
builder.Append(" tenant: ");
if (Tenant.Contains(Environment.NewLine))
{
builder.AppendLine("'''");
builder.AppendLine($"{Tenant}'''");
}
else
{
builder.AppendLine($"'{Tenant}'");
}
}
}
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" displayName: ");
builder.AppendLine(propertyOverride);
}
else
{
if (Optional.IsDefined(DisplayName))
{
builder.Append(" displayName: ");
if (DisplayName.Contains(Environment.NewLine))
{
builder.AppendLine("'''");
builder.AppendLine($"{DisplayName}'''");
}
else
{
builder.AppendLine($"'{DisplayName}'");
}
}
}
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ParentId", out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" parent: ");
builder.AppendLine("{");
builder.AppendLine(" parent: {");
builder.Append(" id: ");
builder.AppendLine(propertyOverride);
builder.AppendLine(" }");
builder.AppendLine(" }");
}
else
{
if (Optional.IsDefined(Parent))
{
builder.Append(" parent: ");
BicepSerializationHelpers.AppendChildObject(builder, Parent, options, 4, false, " parent: ");
}
}
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride);
if (hasPropertyOverride)
{
builder.Append(" state: ");
builder.AppendLine(propertyOverride);
}
else
{
if (Optional.IsDefined(State))
{
builder.Append(" state: ");
if (State.Contains(Environment.NewLine))
{
builder.AppendLine("'''");
builder.AppendLine($"{State}'''");
}
else
{
builder.AppendLine($"'{State}'");
}
}
}
builder.AppendLine(" }");
builder.AppendLine("}");
return BinaryData.FromString(builder.ToString());
}
BinaryData IPersistableModel<ManagementGroupSubscriptionData>.Write(ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel<ManagementGroupSubscriptionData>)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options, AzureResourceManagerContext.Default);
case "bicep":
return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(ManagementGroupSubscriptionData)} does not support writing '{options.Format}' format.");
}
}
ManagementGroupSubscriptionData IPersistableModel<ManagementGroupSubscriptionData>.Create(BinaryData data, ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel<ManagementGroupSubscriptionData>)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
{
using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
return DeserializeManagementGroupSubscriptionData(document.RootElement, options);
}
default:
throw new FormatException($"The model {nameof(ManagementGroupSubscriptionData)} does not support reading '{options.Format}' format.");
}
}
string IPersistableModel<ManagementGroupSubscriptionData>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
}
}