| | 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 LocalNetworkGateway : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 88 | 18 | | writer.WriteStartObject(); |
| 88 | 19 | | if (Etag != null) |
| | 20 | | { |
| 56 | 21 | | writer.WritePropertyName("etag"); |
| 56 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 88 | 24 | | if (Id != null) |
| | 25 | | { |
| 56 | 26 | | writer.WritePropertyName("id"); |
| 56 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 88 | 29 | | if (Name != null) |
| | 30 | | { |
| 56 | 31 | | writer.WritePropertyName("name"); |
| 56 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 88 | 34 | | if (Type != null) |
| | 35 | | { |
| 56 | 36 | | writer.WritePropertyName("type"); |
| 56 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 88 | 39 | | if (Location != null) |
| | 40 | | { |
| 88 | 41 | | writer.WritePropertyName("location"); |
| 88 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 88 | 44 | | if (Tags != null) |
| | 45 | | { |
| 88 | 46 | | writer.WritePropertyName("tags"); |
| 88 | 47 | | writer.WriteStartObject(); |
| 352 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 88 | 50 | | writer.WritePropertyName(item.Key); |
| 88 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 88 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 88 | 55 | | writer.WritePropertyName("properties"); |
| 88 | 56 | | writer.WriteStartObject(); |
| 88 | 57 | | if (LocalNetworkAddressSpace != null) |
| | 58 | | { |
| 88 | 59 | | writer.WritePropertyName("localNetworkAddressSpace"); |
| 88 | 60 | | writer.WriteObjectValue(LocalNetworkAddressSpace); |
| | 61 | | } |
| 88 | 62 | | if (GatewayIpAddress != null) |
| | 63 | | { |
| 88 | 64 | | writer.WritePropertyName("gatewayIpAddress"); |
| 88 | 65 | | writer.WriteStringValue(GatewayIpAddress); |
| | 66 | | } |
| 88 | 67 | | if (Fqdn != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("fqdn"); |
| 0 | 70 | | writer.WriteStringValue(Fqdn); |
| | 71 | | } |
| 88 | 72 | | if (BgpSettings != null) |
| | 73 | | { |
| 16 | 74 | | writer.WritePropertyName("bgpSettings"); |
| 16 | 75 | | writer.WriteObjectValue(BgpSettings); |
| | 76 | | } |
| 88 | 77 | | if (ResourceGuid != null) |
| | 78 | | { |
| 56 | 79 | | writer.WritePropertyName("resourceGuid"); |
| 56 | 80 | | writer.WriteStringValue(ResourceGuid); |
| | 81 | | } |
| 88 | 82 | | if (ProvisioningState != null) |
| | 83 | | { |
| 56 | 84 | | writer.WritePropertyName("provisioningState"); |
| 56 | 85 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 86 | | } |
| 88 | 87 | | writer.WriteEndObject(); |
| 88 | 88 | | writer.WriteEndObject(); |
| 88 | 89 | | } |
| | 90 | |
|
| | 91 | | internal static LocalNetworkGateway DeserializeLocalNetworkGateway(JsonElement element) |
| | 92 | | { |
| 104 | 93 | | string etag = default; |
| 104 | 94 | | string id = default; |
| 104 | 95 | | string name = default; |
| 104 | 96 | | string type = default; |
| 104 | 97 | | string location = default; |
| 104 | 98 | | IDictionary<string, string> tags = default; |
| 104 | 99 | | AddressSpace localNetworkAddressSpace = default; |
| 104 | 100 | | string gatewayIpAddress = default; |
| 104 | 101 | | string fqdn = default; |
| 104 | 102 | | BgpSettings bgpSettings = default; |
| 104 | 103 | | string resourceGuid = default; |
| 104 | 104 | | ProvisioningState? provisioningState = default; |
| 944 | 105 | | foreach (var property in element.EnumerateObject()) |
| | 106 | | { |
| 368 | 107 | | if (property.NameEquals("etag")) |
| | 108 | | { |
| 44 | 109 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 110 | | { |
| | 111 | | continue; |
| | 112 | | } |
| 44 | 113 | | etag = property.Value.GetString(); |
| 44 | 114 | | continue; |
| | 115 | | } |
| 324 | 116 | | if (property.NameEquals("id")) |
| | 117 | | { |
| 104 | 118 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 104 | 122 | | id = property.Value.GetString(); |
| 104 | 123 | | continue; |
| | 124 | | } |
| 220 | 125 | | if (property.NameEquals("name")) |
| | 126 | | { |
| 44 | 127 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 44 | 131 | | name = property.Value.GetString(); |
| 44 | 132 | | continue; |
| | 133 | | } |
| 176 | 134 | | if (property.NameEquals("type")) |
| | 135 | | { |
| 44 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 44 | 140 | | type = property.Value.GetString(); |
| 44 | 141 | | continue; |
| | 142 | | } |
| 132 | 143 | | if (property.NameEquals("location")) |
| | 144 | | { |
| 44 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 44 | 149 | | location = property.Value.GetString(); |
| 44 | 150 | | continue; |
| | 151 | | } |
| 88 | 152 | | if (property.NameEquals("tags")) |
| | 153 | | { |
| 44 | 154 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 44 | 158 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 176 | 159 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 160 | | { |
| 44 | 161 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| 0 | 163 | | dictionary.Add(property0.Name, null); |
| | 164 | | } |
| | 165 | | else |
| | 166 | | { |
| 44 | 167 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 168 | | } |
| | 169 | | } |
| 44 | 170 | | tags = dictionary; |
| 44 | 171 | | continue; |
| | 172 | | } |
| 44 | 173 | | if (property.NameEquals("properties")) |
| | 174 | | { |
| 456 | 175 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 176 | | { |
| 184 | 177 | | if (property0.NameEquals("localNetworkAddressSpace")) |
| | 178 | | { |
| 44 | 179 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| | 181 | | continue; |
| | 182 | | } |
| 44 | 183 | | localNetworkAddressSpace = AddressSpace.DeserializeAddressSpace(property0.Value); |
| 44 | 184 | | continue; |
| | 185 | | } |
| 140 | 186 | | if (property0.NameEquals("gatewayIpAddress")) |
| | 187 | | { |
| 44 | 188 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 189 | | { |
| | 190 | | continue; |
| | 191 | | } |
| 44 | 192 | | gatewayIpAddress = property0.Value.GetString(); |
| 44 | 193 | | continue; |
| | 194 | | } |
| 96 | 195 | | if (property0.NameEquals("fqdn")) |
| | 196 | | { |
| 0 | 197 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 198 | | { |
| | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | fqdn = property0.Value.GetString(); |
| 0 | 202 | | continue; |
| | 203 | | } |
| 96 | 204 | | if (property0.NameEquals("bgpSettings")) |
| | 205 | | { |
| 8 | 206 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 207 | | { |
| | 208 | | continue; |
| | 209 | | } |
| 8 | 210 | | bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value); |
| 8 | 211 | | continue; |
| | 212 | | } |
| 88 | 213 | | if (property0.NameEquals("resourceGuid")) |
| | 214 | | { |
| 44 | 215 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 216 | | { |
| | 217 | | continue; |
| | 218 | | } |
| 44 | 219 | | resourceGuid = property0.Value.GetString(); |
| 44 | 220 | | continue; |
| | 221 | | } |
| 44 | 222 | | if (property0.NameEquals("provisioningState")) |
| | 223 | | { |
| 44 | 224 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 225 | | { |
| | 226 | | continue; |
| | 227 | | } |
| 44 | 228 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 229 | | continue; |
| | 230 | | } |
| | 231 | | } |
| | 232 | | continue; |
| | 233 | | } |
| | 234 | | } |
| 104 | 235 | | return new LocalNetworkGateway(id, name, type, location, tags, etag, localNetworkAddressSpace, gatewayIpAddr |
| | 236 | | } |
| | 237 | | } |
| | 238 | | } |