| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class Disallowed : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (DiskTypes != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("diskTypes"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in DiskTypes) |
| | 24 | | { |
| 0 | 25 | | writer.WriteStringValue(item); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | writer.WriteEndObject(); |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | | internal static Disallowed DeserializeDisallowed(JsonElement element) |
| | 33 | | { |
| 0 | 34 | | IList<string> diskTypes = default; |
| 0 | 35 | | foreach (var property in element.EnumerateObject()) |
| | 36 | | { |
| 0 | 37 | | if (property.NameEquals("diskTypes")) |
| | 38 | | { |
| 0 | 39 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 40 | | { |
| | 41 | | continue; |
| | 42 | | } |
| 0 | 43 | | List<string> array = new List<string>(); |
| 0 | 44 | | foreach (var item in property.Value.EnumerateArray()) |
| | 45 | | { |
| 0 | 46 | | if (item.ValueKind == JsonValueKind.Null) |
| | 47 | | { |
| 0 | 48 | | array.Add(null); |
| | 49 | | } |
| | 50 | | else |
| | 51 | | { |
| 0 | 52 | | array.Add(item.GetString()); |
| | 53 | | } |
| | 54 | | } |
| 0 | 55 | | diskTypes = array; |
| | 56 | | continue; |
| | 57 | | } |
| | 58 | | } |
| 0 | 59 | | return new Disallowed(diskTypes); |
| | 60 | | } |
| | 61 | | } |
| | 62 | | } |