| | 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.Resources.Models |
| | 13 | | { |
| | 14 | | public partial class LocationMetadata |
| | 15 | | { |
| | 16 | | internal static LocationMetadata DeserializeLocationMetadata(JsonElement element) |
| | 17 | | { |
| 8 | 18 | | RegionType? regionType = default; |
| 8 | 19 | | RegionCategory? regionCategory = default; |
| 8 | 20 | | string geographyGroup = default; |
| 8 | 21 | | string longitude = default; |
| 8 | 22 | | string latitude = default; |
| 8 | 23 | | string physicalLocation = default; |
| 8 | 24 | | IReadOnlyList<PairedRegion> pairedRegion = default; |
| 48 | 25 | | foreach (var property in element.EnumerateObject()) |
| | 26 | | { |
| 16 | 27 | | if (property.NameEquals("regionType")) |
| | 28 | | { |
| 0 | 29 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 30 | | { |
| | 31 | | continue; |
| | 32 | | } |
| 0 | 33 | | regionType = new RegionType(property.Value.GetString()); |
| 0 | 34 | | continue; |
| | 35 | | } |
| 16 | 36 | | if (property.NameEquals("regionCategory")) |
| | 37 | | { |
| 0 | 38 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 39 | | { |
| | 40 | | continue; |
| | 41 | | } |
| 0 | 42 | | regionCategory = new RegionCategory(property.Value.GetString()); |
| 0 | 43 | | continue; |
| | 44 | | } |
| 16 | 45 | | if (property.NameEquals("geographyGroup")) |
| | 46 | | { |
| 0 | 47 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | geographyGroup = property.Value.GetString(); |
| 0 | 52 | | continue; |
| | 53 | | } |
| 16 | 54 | | if (property.NameEquals("longitude")) |
| | 55 | | { |
| 8 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 8 | 60 | | longitude = property.Value.GetString(); |
| 8 | 61 | | continue; |
| | 62 | | } |
| 8 | 63 | | if (property.NameEquals("latitude")) |
| | 64 | | { |
| 8 | 65 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 66 | | { |
| | 67 | | continue; |
| | 68 | | } |
| 8 | 69 | | latitude = property.Value.GetString(); |
| 8 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("physicalLocation")) |
| | 73 | | { |
| 0 | 74 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | physicalLocation = property.Value.GetString(); |
| 0 | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | if (property.NameEquals("pairedRegion")) |
| | 82 | | { |
| 0 | 83 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 84 | | { |
| | 85 | | continue; |
| | 86 | | } |
| 0 | 87 | | List<PairedRegion> array = new List<PairedRegion>(); |
| 0 | 88 | | foreach (var item in property.Value.EnumerateArray()) |
| | 89 | | { |
| 0 | 90 | | if (item.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| 0 | 92 | | array.Add(null); |
| | 93 | | } |
| | 94 | | else |
| | 95 | | { |
| 0 | 96 | | array.Add(Models.PairedRegion.DeserializePairedRegion(item)); |
| | 97 | | } |
| | 98 | | } |
| 0 | 99 | | pairedRegion = array; |
| | 100 | | continue; |
| | 101 | | } |
| | 102 | | } |
| 8 | 103 | | return new LocationMetadata(regionType, regionCategory, geographyGroup, longitude, latitude, physicalLocatio |
| | 104 | | } |
| | 105 | | } |
| | 106 | | } |