| | | 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 ResourceSkuRestrictions |
| | | 15 | | { |
| | | 16 | | internal static ResourceSkuRestrictions DeserializeResourceSkuRestrictions(JsonElement element) |
| | | 17 | | { |
| | 15212 | 18 | | ResourceSkuRestrictionsType? type = default; |
| | 15212 | 19 | | IReadOnlyList<string> values = default; |
| | 15212 | 20 | | ResourceSkuRestrictionInfo restrictionInfo = default; |
| | 15212 | 21 | | ResourceSkuRestrictionsReasonCode? reasonCode = default; |
| | 152120 | 22 | | foreach (var property in element.EnumerateObject()) |
| | | 23 | | { |
| | 60848 | 24 | | if (property.NameEquals("type")) |
| | | 25 | | { |
| | 15212 | 26 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 27 | | { |
| | | 28 | | continue; |
| | | 29 | | } |
| | 15212 | 30 | | type = property.Value.GetString().ToResourceSkuRestrictionsType(); |
| | 15212 | 31 | | continue; |
| | | 32 | | } |
| | 45636 | 33 | | if (property.NameEquals("values")) |
| | | 34 | | { |
| | 15212 | 35 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 36 | | { |
| | | 37 | | continue; |
| | | 38 | | } |
| | 15212 | 39 | | List<string> array = new List<string>(); |
| | 60848 | 40 | | foreach (var item in property.Value.EnumerateArray()) |
| | | 41 | | { |
| | 15212 | 42 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 43 | | { |
| | 0 | 44 | | array.Add(null); |
| | | 45 | | } |
| | | 46 | | else |
| | | 47 | | { |
| | 15212 | 48 | | array.Add(item.GetString()); |
| | | 49 | | } |
| | | 50 | | } |
| | 15212 | 51 | | values = array; |
| | 15212 | 52 | | continue; |
| | | 53 | | } |
| | 30424 | 54 | | if (property.NameEquals("restrictionInfo")) |
| | | 55 | | { |
| | 15212 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 57 | | { |
| | | 58 | | continue; |
| | | 59 | | } |
| | 15212 | 60 | | restrictionInfo = ResourceSkuRestrictionInfo.DeserializeResourceSkuRestrictionInfo(property.Value); |
| | 15212 | 61 | | continue; |
| | | 62 | | } |
| | 15212 | 63 | | if (property.NameEquals("reasonCode")) |
| | | 64 | | { |
| | 15212 | 65 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 66 | | { |
| | | 67 | | continue; |
| | | 68 | | } |
| | 15212 | 69 | | reasonCode = property.Value.GetString().ToResourceSkuRestrictionsReasonCode(); |
| | | 70 | | continue; |
| | | 71 | | } |
| | | 72 | | } |
| | 15212 | 73 | | return new ResourceSkuRestrictions(type, values, restrictionInfo, reasonCode); |
| | | 74 | | } |
| | | 75 | | } |
| | | 76 | | } |