| | | 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.Network.Models |
| | | 13 | | { |
| | | 14 | | public partial class PrivateDnsZoneConfig : IUtf8JsonSerializable |
| | | 15 | | { |
| | | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 17 | | { |
| | 0 | 18 | | writer.WriteStartObject(); |
| | 0 | 19 | | if (Name != null) |
| | | 20 | | { |
| | 0 | 21 | | writer.WritePropertyName("name"); |
| | 0 | 22 | | writer.WriteStringValue(Name); |
| | | 23 | | } |
| | 0 | 24 | | writer.WritePropertyName("properties"); |
| | 0 | 25 | | writer.WriteStartObject(); |
| | 0 | 26 | | if (PrivateDnsZoneId != null) |
| | | 27 | | { |
| | 0 | 28 | | writer.WritePropertyName("privateDnsZoneId"); |
| | 0 | 29 | | writer.WriteStringValue(PrivateDnsZoneId); |
| | | 30 | | } |
| | 0 | 31 | | if (RecordSets != null) |
| | | 32 | | { |
| | 0 | 33 | | writer.WritePropertyName("recordSets"); |
| | 0 | 34 | | writer.WriteStartArray(); |
| | 0 | 35 | | foreach (var item in RecordSets) |
| | | 36 | | { |
| | 0 | 37 | | writer.WriteObjectValue(item); |
| | | 38 | | } |
| | 0 | 39 | | writer.WriteEndArray(); |
| | | 40 | | } |
| | 0 | 41 | | writer.WriteEndObject(); |
| | 0 | 42 | | writer.WriteEndObject(); |
| | 0 | 43 | | } |
| | | 44 | | |
| | | 45 | | internal static PrivateDnsZoneConfig DeserializePrivateDnsZoneConfig(JsonElement element) |
| | | 46 | | { |
| | 0 | 47 | | string name = default; |
| | 0 | 48 | | string privateDnsZoneId = default; |
| | 0 | 49 | | IList<RecordSet> recordSets = default; |
| | 0 | 50 | | foreach (var property in element.EnumerateObject()) |
| | | 51 | | { |
| | 0 | 52 | | if (property.NameEquals("name")) |
| | | 53 | | { |
| | 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 55 | | { |
| | | 56 | | continue; |
| | | 57 | | } |
| | 0 | 58 | | name = property.Value.GetString(); |
| | 0 | 59 | | continue; |
| | | 60 | | } |
| | 0 | 61 | | if (property.NameEquals("properties")) |
| | | 62 | | { |
| | 0 | 63 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | | 64 | | { |
| | 0 | 65 | | if (property0.NameEquals("privateDnsZoneId")) |
| | | 66 | | { |
| | 0 | 67 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 68 | | { |
| | | 69 | | continue; |
| | | 70 | | } |
| | 0 | 71 | | privateDnsZoneId = property0.Value.GetString(); |
| | 0 | 72 | | continue; |
| | | 73 | | } |
| | 0 | 74 | | if (property0.NameEquals("recordSets")) |
| | | 75 | | { |
| | 0 | 76 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 77 | | { |
| | | 78 | | continue; |
| | | 79 | | } |
| | 0 | 80 | | List<RecordSet> array = new List<RecordSet>(); |
| | 0 | 81 | | foreach (var item in property0.Value.EnumerateArray()) |
| | | 82 | | { |
| | 0 | 83 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 84 | | { |
| | 0 | 85 | | array.Add(null); |
| | | 86 | | } |
| | | 87 | | else |
| | | 88 | | { |
| | 0 | 89 | | array.Add(RecordSet.DeserializeRecordSet(item)); |
| | | 90 | | } |
| | | 91 | | } |
| | 0 | 92 | | recordSets = array; |
| | | 93 | | continue; |
| | | 94 | | } |
| | | 95 | | } |
| | | 96 | | continue; |
| | | 97 | | } |
| | | 98 | | } |
| | 0 | 99 | | return new PrivateDnsZoneConfig(name, privateDnsZoneId, recordSets); |
| | | 100 | | } |
| | | 101 | | } |
| | | 102 | | } |