| | 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 RecordSet : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (RecordType != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("recordType"); |
| 0 | 22 | | writer.WriteStringValue(RecordType); |
| | 23 | | } |
| 0 | 24 | | if (RecordSetName != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("recordSetName"); |
| 0 | 27 | | writer.WriteStringValue(RecordSetName); |
| | 28 | | } |
| 0 | 29 | | if (Fqdn != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("fqdn"); |
| 0 | 32 | | writer.WriteStringValue(Fqdn); |
| | 33 | | } |
| 0 | 34 | | if (ProvisioningState != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("provisioningState"); |
| 0 | 37 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 38 | | } |
| 0 | 39 | | if (Ttl != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("ttl"); |
| 0 | 42 | | writer.WriteNumberValue(Ttl.Value); |
| | 43 | | } |
| 0 | 44 | | if (IpAddresses != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("ipAddresses"); |
| 0 | 47 | | writer.WriteStartArray(); |
| 0 | 48 | | foreach (var item in IpAddresses) |
| | 49 | | { |
| 0 | 50 | | writer.WriteStringValue(item); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 0 | 54 | | writer.WriteEndObject(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | internal static RecordSet DeserializeRecordSet(JsonElement element) |
| | 58 | | { |
| 0 | 59 | | string recordType = default; |
| 0 | 60 | | string recordSetName = default; |
| 0 | 61 | | string fqdn = default; |
| 0 | 62 | | ProvisioningState? provisioningState = default; |
| 0 | 63 | | int? ttl = default; |
| 0 | 64 | | IList<string> ipAddresses = default; |
| 0 | 65 | | foreach (var property in element.EnumerateObject()) |
| | 66 | | { |
| 0 | 67 | | if (property.NameEquals("recordType")) |
| | 68 | | { |
| 0 | 69 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 70 | | { |
| | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | recordType = property.Value.GetString(); |
| 0 | 74 | | continue; |
| | 75 | | } |
| 0 | 76 | | if (property.NameEquals("recordSetName")) |
| | 77 | | { |
| 0 | 78 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | recordSetName = property.Value.GetString(); |
| 0 | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | if (property.NameEquals("fqdn")) |
| | 86 | | { |
| 0 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | fqdn = property.Value.GetString(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("provisioningState")) |
| | 95 | | { |
| 0 | 96 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 97 | | { |
| | 98 | | continue; |
| | 99 | | } |
| 0 | 100 | | provisioningState = new ProvisioningState(property.Value.GetString()); |
| 0 | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | if (property.NameEquals("ttl")) |
| | 104 | | { |
| 0 | 105 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | ttl = property.Value.GetInt32(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property.NameEquals("ipAddresses")) |
| | 113 | | { |
| 0 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | List<string> array = new List<string>(); |
| 0 | 119 | | foreach (var item in property.Value.EnumerateArray()) |
| | 120 | | { |
| 0 | 121 | | if (item.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| 0 | 123 | | array.Add(null); |
| | 124 | | } |
| | 125 | | else |
| | 126 | | { |
| 0 | 127 | | array.Add(item.GetString()); |
| | 128 | | } |
| | 129 | | } |
| 0 | 130 | | ipAddresses = array; |
| | 131 | | continue; |
| | 132 | | } |
| | 133 | | } |
| 0 | 134 | | return new RecordSet(recordType, recordSetName, fqdn, provisioningState, ttl, ipAddresses); |
| | 135 | | } |
| | 136 | | } |
| | 137 | | } |