| | 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 PublicIPAddress : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 176 | 18 | | writer.WriteStartObject(); |
| 176 | 19 | | if (Sku != null) |
| | 20 | | { |
| 8 | 21 | | writer.WritePropertyName("sku"); |
| 8 | 22 | | writer.WriteObjectValue(Sku); |
| | 23 | | } |
| 176 | 24 | | if (Etag != null) |
| | 25 | | { |
| 8 | 26 | | writer.WritePropertyName("etag"); |
| 8 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 176 | 29 | | if (Zones != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("zones"); |
| 0 | 32 | | writer.WriteStartArray(); |
| 0 | 33 | | foreach (var item in Zones) |
| | 34 | | { |
| 0 | 35 | | writer.WriteStringValue(item); |
| | 36 | | } |
| 0 | 37 | | writer.WriteEndArray(); |
| | 38 | | } |
| 176 | 39 | | if (Id != null) |
| | 40 | | { |
| 64 | 41 | | writer.WritePropertyName("id"); |
| 64 | 42 | | writer.WriteStringValue(Id); |
| | 43 | | } |
| 176 | 44 | | if (Name != null) |
| | 45 | | { |
| 8 | 46 | | writer.WritePropertyName("name"); |
| 8 | 47 | | writer.WriteStringValue(Name); |
| | 48 | | } |
| 176 | 49 | | if (Type != null) |
| | 50 | | { |
| 8 | 51 | | writer.WritePropertyName("type"); |
| 8 | 52 | | writer.WriteStringValue(Type); |
| | 53 | | } |
| 176 | 54 | | if (Location != null) |
| | 55 | | { |
| 120 | 56 | | writer.WritePropertyName("location"); |
| 120 | 57 | | writer.WriteStringValue(Location); |
| | 58 | | } |
| 176 | 59 | | if (Tags != null) |
| | 60 | | { |
| 120 | 61 | | writer.WritePropertyName("tags"); |
| 120 | 62 | | writer.WriteStartObject(); |
| 480 | 63 | | foreach (var item in Tags) |
| | 64 | | { |
| 120 | 65 | | writer.WritePropertyName(item.Key); |
| 120 | 66 | | writer.WriteStringValue(item.Value); |
| | 67 | | } |
| 120 | 68 | | writer.WriteEndObject(); |
| | 69 | | } |
| 176 | 70 | | writer.WritePropertyName("properties"); |
| 176 | 71 | | writer.WriteStartObject(); |
| 176 | 72 | | if (PublicIPAllocationMethod != null) |
| | 73 | | { |
| 120 | 74 | | writer.WritePropertyName("publicIPAllocationMethod"); |
| 120 | 75 | | writer.WriteStringValue(PublicIPAllocationMethod.Value.ToString()); |
| | 76 | | } |
| 176 | 77 | | if (PublicIPAddressVersion != null) |
| | 78 | | { |
| 24 | 79 | | writer.WritePropertyName("publicIPAddressVersion"); |
| 24 | 80 | | writer.WriteStringValue(PublicIPAddressVersion.Value.ToString()); |
| | 81 | | } |
| 176 | 82 | | if (IpConfiguration != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("ipConfiguration"); |
| 0 | 85 | | writer.WriteObjectValue(IpConfiguration); |
| | 86 | | } |
| 176 | 87 | | if (DnsSettings != null) |
| | 88 | | { |
| 120 | 89 | | writer.WritePropertyName("dnsSettings"); |
| 120 | 90 | | writer.WriteObjectValue(DnsSettings); |
| | 91 | | } |
| 176 | 92 | | if (DdosSettings != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("ddosSettings"); |
| 0 | 95 | | writer.WriteObjectValue(DdosSettings); |
| | 96 | | } |
| 176 | 97 | | if (IpTags != null) |
| | 98 | | { |
| 8 | 99 | | writer.WritePropertyName("ipTags"); |
| 8 | 100 | | writer.WriteStartArray(); |
| 0 | 101 | | foreach (var item in IpTags) |
| | 102 | | { |
| 0 | 103 | | writer.WriteObjectValue(item); |
| | 104 | | } |
| 8 | 105 | | writer.WriteEndArray(); |
| | 106 | | } |
| 176 | 107 | | if (IpAddress != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("ipAddress"); |
| 0 | 110 | | writer.WriteStringValue(IpAddress); |
| | 111 | | } |
| 176 | 112 | | if (PublicIPPrefix != null) |
| | 113 | | { |
| 0 | 114 | | writer.WritePropertyName("publicIPPrefix"); |
| 0 | 115 | | writer.WriteObjectValue(PublicIPPrefix); |
| | 116 | | } |
| 176 | 117 | | if (IdleTimeoutInMinutes != null) |
| | 118 | | { |
| 16 | 119 | | writer.WritePropertyName("idleTimeoutInMinutes"); |
| 16 | 120 | | writer.WriteNumberValue(IdleTimeoutInMinutes.Value); |
| | 121 | | } |
| 176 | 122 | | if (ResourceGuid != null) |
| | 123 | | { |
| 8 | 124 | | writer.WritePropertyName("resourceGuid"); |
| 8 | 125 | | writer.WriteStringValue(ResourceGuid); |
| | 126 | | } |
| 176 | 127 | | if (ProvisioningState != null) |
| | 128 | | { |
| 8 | 129 | | writer.WritePropertyName("provisioningState"); |
| 8 | 130 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 131 | | } |
| 176 | 132 | | writer.WriteEndObject(); |
| 176 | 133 | | writer.WriteEndObject(); |
| 176 | 134 | | } |
| | 135 | |
|
| | 136 | | internal static PublicIPAddress DeserializePublicIPAddress(JsonElement element) |
| | 137 | | { |
| 356 | 138 | | PublicIPAddressSku sku = default; |
| 356 | 139 | | string etag = default; |
| 356 | 140 | | IList<string> zones = default; |
| 356 | 141 | | string id = default; |
| 356 | 142 | | string name = default; |
| 356 | 143 | | string type = default; |
| 356 | 144 | | string location = default; |
| 356 | 145 | | IDictionary<string, string> tags = default; |
| 356 | 146 | | IPAllocationMethod? publicIPAllocationMethod = default; |
| 356 | 147 | | IPVersion? publicIPAddressVersion = default; |
| 356 | 148 | | IPConfiguration ipConfiguration = default; |
| 356 | 149 | | PublicIPAddressDnsSettings dnsSettings = default; |
| 356 | 150 | | DdosSettings ddosSettings = default; |
| 356 | 151 | | IList<IpTag> ipTags = default; |
| 356 | 152 | | string ipAddress = default; |
| 356 | 153 | | SubResource publicIPPrefix = default; |
| 356 | 154 | | int? idleTimeoutInMinutes = default; |
| 356 | 155 | | string resourceGuid = default; |
| 356 | 156 | | ProvisioningState? provisioningState = default; |
| 4376 | 157 | | foreach (var property in element.EnumerateObject()) |
| | 158 | | { |
| 1832 | 159 | | if (property.NameEquals("sku")) |
| | 160 | | { |
| 228 | 161 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| | 163 | | continue; |
| | 164 | | } |
| 228 | 165 | | sku = PublicIPAddressSku.DeserializePublicIPAddressSku(property.Value); |
| 228 | 166 | | continue; |
| | 167 | | } |
| 1604 | 168 | | if (property.NameEquals("etag")) |
| | 169 | | { |
| 228 | 170 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 171 | | { |
| | 172 | | continue; |
| | 173 | | } |
| 228 | 174 | | etag = property.Value.GetString(); |
| 228 | 175 | | continue; |
| | 176 | | } |
| 1376 | 177 | | if (property.NameEquals("zones")) |
| | 178 | | { |
| 0 | 179 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| | 181 | | continue; |
| | 182 | | } |
| 0 | 183 | | List<string> array = new List<string>(); |
| 0 | 184 | | foreach (var item in property.Value.EnumerateArray()) |
| | 185 | | { |
| 0 | 186 | | if (item.ValueKind == JsonValueKind.Null) |
| | 187 | | { |
| 0 | 188 | | array.Add(null); |
| | 189 | | } |
| | 190 | | else |
| | 191 | | { |
| 0 | 192 | | array.Add(item.GetString()); |
| | 193 | | } |
| | 194 | | } |
| 0 | 195 | | zones = array; |
| 0 | 196 | | continue; |
| | 197 | | } |
| 1376 | 198 | | if (property.NameEquals("id")) |
| | 199 | | { |
| 356 | 200 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| | 202 | | continue; |
| | 203 | | } |
| 356 | 204 | | id = property.Value.GetString(); |
| 356 | 205 | | continue; |
| | 206 | | } |
| 1020 | 207 | | if (property.NameEquals("name")) |
| | 208 | | { |
| 228 | 209 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| | 211 | | continue; |
| | 212 | | } |
| 228 | 213 | | name = property.Value.GetString(); |
| 228 | 214 | | continue; |
| | 215 | | } |
| 792 | 216 | | if (property.NameEquals("type")) |
| | 217 | | { |
| 188 | 218 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 219 | | { |
| | 220 | | continue; |
| | 221 | | } |
| 188 | 222 | | type = property.Value.GetString(); |
| 188 | 223 | | continue; |
| | 224 | | } |
| 604 | 225 | | if (property.NameEquals("location")) |
| | 226 | | { |
| 188 | 227 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 228 | | { |
| | 229 | | continue; |
| | 230 | | } |
| 188 | 231 | | location = property.Value.GetString(); |
| 188 | 232 | | continue; |
| | 233 | | } |
| 416 | 234 | | if (property.NameEquals("tags")) |
| | 235 | | { |
| 188 | 236 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 237 | | { |
| | 238 | | continue; |
| | 239 | | } |
| 188 | 240 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 752 | 241 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 242 | | { |
| 188 | 243 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 244 | | { |
| 0 | 245 | | dictionary.Add(property0.Name, null); |
| | 246 | | } |
| | 247 | | else |
| | 248 | | { |
| 188 | 249 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 250 | | } |
| | 251 | | } |
| 188 | 252 | | tags = dictionary; |
| 188 | 253 | | continue; |
| | 254 | | } |
| 228 | 255 | | if (property.NameEquals("properties")) |
| | 256 | | { |
| 3792 | 257 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 258 | | { |
| 1668 | 259 | | if (property0.NameEquals("publicIPAllocationMethod")) |
| | 260 | | { |
| 228 | 261 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 262 | | { |
| | 263 | | continue; |
| | 264 | | } |
| 228 | 265 | | publicIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); |
| 228 | 266 | | continue; |
| | 267 | | } |
| 1440 | 268 | | if (property0.NameEquals("publicIPAddressVersion")) |
| | 269 | | { |
| 228 | 270 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| | 272 | | continue; |
| | 273 | | } |
| 228 | 274 | | publicIPAddressVersion = new IPVersion(property0.Value.GetString()); |
| 228 | 275 | | continue; |
| | 276 | | } |
| 1212 | 277 | | if (property0.NameEquals("ipConfiguration")) |
| | 278 | | { |
| 48 | 279 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 280 | | { |
| | 281 | | continue; |
| | 282 | | } |
| 48 | 283 | | ipConfiguration = IPConfiguration.DeserializeIPConfiguration(property0.Value); |
| 48 | 284 | | continue; |
| | 285 | | } |
| 1164 | 286 | | if (property0.NameEquals("dnsSettings")) |
| | 287 | | { |
| 228 | 288 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 289 | | { |
| | 290 | | continue; |
| | 291 | | } |
| 228 | 292 | | dnsSettings = PublicIPAddressDnsSettings.DeserializePublicIPAddressDnsSettings(property0.Val |
| 228 | 293 | | continue; |
| | 294 | | } |
| 936 | 295 | | if (property0.NameEquals("ddosSettings")) |
| | 296 | | { |
| 0 | 297 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 298 | | { |
| | 299 | | continue; |
| | 300 | | } |
| 0 | 301 | | ddosSettings = DdosSettings.DeserializeDdosSettings(property0.Value); |
| 0 | 302 | | continue; |
| | 303 | | } |
| 936 | 304 | | if (property0.NameEquals("ipTags")) |
| | 305 | | { |
| 228 | 306 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 307 | | { |
| | 308 | | continue; |
| | 309 | | } |
| 228 | 310 | | List<IpTag> array = new List<IpTag>(); |
| 0 | 311 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 312 | | { |
| 0 | 313 | | if (item.ValueKind == JsonValueKind.Null) |
| | 314 | | { |
| 0 | 315 | | array.Add(null); |
| | 316 | | } |
| | 317 | | else |
| | 318 | | { |
| 0 | 319 | | array.Add(IpTag.DeserializeIpTag(item)); |
| | 320 | | } |
| | 321 | | } |
| 228 | 322 | | ipTags = array; |
| 228 | 323 | | continue; |
| | 324 | | } |
| 708 | 325 | | if (property0.NameEquals("ipAddress")) |
| | 326 | | { |
| 24 | 327 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 328 | | { |
| | 329 | | continue; |
| | 330 | | } |
| 24 | 331 | | ipAddress = property0.Value.GetString(); |
| 24 | 332 | | continue; |
| | 333 | | } |
| 684 | 334 | | if (property0.NameEquals("publicIPPrefix")) |
| | 335 | | { |
| 0 | 336 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 337 | | { |
| | 338 | | continue; |
| | 339 | | } |
| 0 | 340 | | publicIPPrefix = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 341 | | continue; |
| | 342 | | } |
| 684 | 343 | | if (property0.NameEquals("idleTimeoutInMinutes")) |
| | 344 | | { |
| 228 | 345 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 346 | | { |
| | 347 | | continue; |
| | 348 | | } |
| 228 | 349 | | idleTimeoutInMinutes = property0.Value.GetInt32(); |
| 228 | 350 | | continue; |
| | 351 | | } |
| 456 | 352 | | if (property0.NameEquals("resourceGuid")) |
| | 353 | | { |
| 228 | 354 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 355 | | { |
| | 356 | | continue; |
| | 357 | | } |
| 228 | 358 | | resourceGuid = property0.Value.GetString(); |
| 228 | 359 | | continue; |
| | 360 | | } |
| 228 | 361 | | if (property0.NameEquals("provisioningState")) |
| | 362 | | { |
| 228 | 363 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 364 | | { |
| | 365 | | continue; |
| | 366 | | } |
| 228 | 367 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 368 | | continue; |
| | 369 | | } |
| | 370 | | } |
| | 371 | | continue; |
| | 372 | | } |
| | 373 | | } |
| 356 | 374 | | return new PublicIPAddress(id, name, type, location, tags, sku, etag, zones, publicIPAllocationMethod, publi |
| | 375 | | } |
| | 376 | | } |
| | 377 | | } |