| | 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.Compute.Models |
| | 13 | | { |
| | 14 | | public partial class ResourceSku |
| | 15 | | { |
| | 16 | | internal static ResourceSku DeserializeResourceSku(JsonElement element) |
| | 17 | | { |
| 40800 | 18 | | string resourceType = default; |
| 40800 | 19 | | string name = default; |
| 40800 | 20 | | string tier = default; |
| 40800 | 21 | | string size = default; |
| 40800 | 22 | | string family = default; |
| 40800 | 23 | | string kind = default; |
| 40800 | 24 | | ResourceSkuCapacity capacity = default; |
| 40800 | 25 | | IReadOnlyList<string> locations = default; |
| 40800 | 26 | | IReadOnlyList<ResourceSkuLocationInfo> locationInfo = default; |
| 40800 | 27 | | IReadOnlyList<string> apiVersions = default; |
| 40800 | 28 | | IReadOnlyList<ResourceSkuCosts> costs = default; |
| 40800 | 29 | | IReadOnlyList<ResourceSkuCapabilities> capabilities = default; |
| 40800 | 30 | | IReadOnlyList<ResourceSkuRestrictions> restrictions = default; |
| 794800 | 31 | | foreach (var property in element.EnumerateObject()) |
| | 32 | | { |
| 356600 | 33 | | if (property.NameEquals("resourceType")) |
| | 34 | | { |
| 40800 | 35 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 36 | | { |
| | 37 | | continue; |
| | 38 | | } |
| 40800 | 39 | | resourceType = property.Value.GetString(); |
| 40800 | 40 | | continue; |
| | 41 | | } |
| 315800 | 42 | | if (property.NameEquals("name")) |
| | 43 | | { |
| 40800 | 44 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 45 | | { |
| | 46 | | continue; |
| | 47 | | } |
| 40800 | 48 | | name = property.Value.GetString(); |
| 40800 | 49 | | continue; |
| | 50 | | } |
| 275000 | 51 | | if (property.NameEquals("tier")) |
| | 52 | | { |
| 39552 | 53 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 54 | | { |
| | 55 | | continue; |
| | 56 | | } |
| 39552 | 57 | | tier = property.Value.GetString(); |
| 39552 | 58 | | continue; |
| | 59 | | } |
| 235448 | 60 | | if (property.NameEquals("size")) |
| | 61 | | { |
| 39164 | 62 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 63 | | { |
| | 64 | | continue; |
| | 65 | | } |
| 39164 | 66 | | size = property.Value.GetString(); |
| 39164 | 67 | | continue; |
| | 68 | | } |
| 196284 | 69 | | if (property.NameEquals("family")) |
| | 70 | | { |
| 33472 | 71 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 72 | | { |
| | 73 | | continue; |
| | 74 | | } |
| 33472 | 75 | | family = property.Value.GetString(); |
| 33472 | 76 | | continue; |
| | 77 | | } |
| 162812 | 78 | | if (property.NameEquals("kind")) |
| | 79 | | { |
| 0 | 80 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 81 | | { |
| | 82 | | continue; |
| | 83 | | } |
| 0 | 84 | | kind = property.Value.GetString(); |
| 0 | 85 | | continue; |
| | 86 | | } |
| 162812 | 87 | | if (property.NameEquals("capacity")) |
| | 88 | | { |
| 0 | 89 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 90 | | { |
| | 91 | | continue; |
| | 92 | | } |
| 0 | 93 | | capacity = ResourceSkuCapacity.DeserializeResourceSkuCapacity(property.Value); |
| 0 | 94 | | continue; |
| | 95 | | } |
| 162812 | 96 | | if (property.NameEquals("locations")) |
| | 97 | | { |
| 40800 | 98 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 99 | | { |
| | 100 | | continue; |
| | 101 | | } |
| 40800 | 102 | | List<string> array = new List<string>(); |
| 163200 | 103 | | foreach (var item in property.Value.EnumerateArray()) |
| | 104 | | { |
| 40800 | 105 | | if (item.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| 0 | 107 | | array.Add(null); |
| | 108 | | } |
| | 109 | | else |
| | 110 | | { |
| 40800 | 111 | | array.Add(item.GetString()); |
| | 112 | | } |
| | 113 | | } |
| 40800 | 114 | | locations = array; |
| 40800 | 115 | | continue; |
| | 116 | | } |
| 122012 | 117 | | if (property.NameEquals("locationInfo")) |
| | 118 | | { |
| 40800 | 119 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 120 | | { |
| | 121 | | continue; |
| | 122 | | } |
| 40800 | 123 | | List<ResourceSkuLocationInfo> array = new List<ResourceSkuLocationInfo>(); |
| 163200 | 124 | | foreach (var item in property.Value.EnumerateArray()) |
| | 125 | | { |
| 40800 | 126 | | if (item.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| 0 | 128 | | array.Add(null); |
| | 129 | | } |
| | 130 | | else |
| | 131 | | { |
| 40800 | 132 | | array.Add(ResourceSkuLocationInfo.DeserializeResourceSkuLocationInfo(item)); |
| | 133 | | } |
| | 134 | | } |
| 40800 | 135 | | locationInfo = array; |
| 40800 | 136 | | continue; |
| | 137 | | } |
| 81212 | 138 | | if (property.NameEquals("apiVersions")) |
| | 139 | | { |
| 0 | 140 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 141 | | { |
| | 142 | | continue; |
| | 143 | | } |
| 0 | 144 | | List<string> array = new List<string>(); |
| 0 | 145 | | foreach (var item in property.Value.EnumerateArray()) |
| | 146 | | { |
| 0 | 147 | | if (item.ValueKind == JsonValueKind.Null) |
| | 148 | | { |
| 0 | 149 | | array.Add(null); |
| | 150 | | } |
| | 151 | | else |
| | 152 | | { |
| 0 | 153 | | array.Add(item.GetString()); |
| | 154 | | } |
| | 155 | | } |
| 0 | 156 | | apiVersions = array; |
| 0 | 157 | | continue; |
| | 158 | | } |
| 81212 | 159 | | if (property.NameEquals("costs")) |
| | 160 | | { |
| 0 | 161 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 162 | | { |
| | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | List<ResourceSkuCosts> array = new List<ResourceSkuCosts>(); |
| 0 | 166 | | foreach (var item in property.Value.EnumerateArray()) |
| | 167 | | { |
| 0 | 168 | | if (item.ValueKind == JsonValueKind.Null) |
| | 169 | | { |
| 0 | 170 | | array.Add(null); |
| | 171 | | } |
| | 172 | | else |
| | 173 | | { |
| 0 | 174 | | array.Add(ResourceSkuCosts.DeserializeResourceSkuCosts(item)); |
| | 175 | | } |
| | 176 | | } |
| 0 | 177 | | costs = array; |
| 0 | 178 | | continue; |
| | 179 | | } |
| 81212 | 180 | | if (property.NameEquals("capabilities")) |
| | 181 | | { |
| 40412 | 182 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 183 | | { |
| | 184 | | continue; |
| | 185 | | } |
| 40412 | 186 | | List<ResourceSkuCapabilities> array = new List<ResourceSkuCapabilities>(); |
| 1577720 | 187 | | foreach (var item in property.Value.EnumerateArray()) |
| | 188 | | { |
| 748448 | 189 | | if (item.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| 0 | 191 | | array.Add(null); |
| | 192 | | } |
| | 193 | | else |
| | 194 | | { |
| 748448 | 195 | | array.Add(ResourceSkuCapabilities.DeserializeResourceSkuCapabilities(item)); |
| | 196 | | } |
| | 197 | | } |
| 40412 | 198 | | capabilities = array; |
| 40412 | 199 | | continue; |
| | 200 | | } |
| 40800 | 201 | | if (property.NameEquals("restrictions")) |
| | 202 | | { |
| 40800 | 203 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 40800 | 207 | | List<ResourceSkuRestrictions> array = new List<ResourceSkuRestrictions>(); |
| 112024 | 208 | | foreach (var item in property.Value.EnumerateArray()) |
| | 209 | | { |
| 15212 | 210 | | if (item.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| 0 | 212 | | array.Add(null); |
| | 213 | | } |
| | 214 | | else |
| | 215 | | { |
| 15212 | 216 | | array.Add(ResourceSkuRestrictions.DeserializeResourceSkuRestrictions(item)); |
| | 217 | | } |
| | 218 | | } |
| 40800 | 219 | | restrictions = array; |
| | 220 | | continue; |
| | 221 | | } |
| | 222 | | } |
| 40800 | 223 | | return new ResourceSku(resourceType, name, tier, size, family, kind, capacity, locations, locationInfo, apiV |
| | 224 | | } |
| | 225 | | } |
| | 226 | | } |