| | 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.Storage.Models |
| | 13 | | { |
| | 14 | | public partial class SkuInformation |
| | 15 | | { |
| | 16 | | internal static SkuInformation DeserializeSkuInformation(JsonElement element) |
| | 17 | | { |
| 2452 | 18 | | SkuName name = default; |
| 2452 | 19 | | SkuTier? tier = default; |
| 2452 | 20 | | string resourceType = default; |
| 2452 | 21 | | Kind? kind = default; |
| 2452 | 22 | | IReadOnlyList<string> locations = default; |
| 2452 | 23 | | IReadOnlyList<SKUCapability> capabilities = default; |
| 2452 | 24 | | IReadOnlyList<Restriction> restrictions = default; |
| 44136 | 25 | | foreach (var property in element.EnumerateObject()) |
| | 26 | | { |
| 19616 | 27 | | if (property.NameEquals("name")) |
| | 28 | | { |
| 2452 | 29 | | name = new SkuName(property.Value.GetString()); |
| 2452 | 30 | | continue; |
| | 31 | | } |
| 17164 | 32 | | if (property.NameEquals("tier")) |
| | 33 | | { |
| 2452 | 34 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 35 | | { |
| | 36 | | continue; |
| | 37 | | } |
| 2452 | 38 | | tier = property.Value.GetString().ToSkuTier(); |
| 2452 | 39 | | continue; |
| | 40 | | } |
| 14712 | 41 | | if (property.NameEquals("resourceType")) |
| | 42 | | { |
| 2452 | 43 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 44 | | { |
| | 45 | | continue; |
| | 46 | | } |
| 2452 | 47 | | resourceType = property.Value.GetString(); |
| 2452 | 48 | | continue; |
| | 49 | | } |
| 12260 | 50 | | if (property.NameEquals("kind")) |
| | 51 | | { |
| 2452 | 52 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 53 | | { |
| | 54 | | continue; |
| | 55 | | } |
| 2452 | 56 | | kind = new Kind(property.Value.GetString()); |
| 2452 | 57 | | continue; |
| | 58 | | } |
| 9808 | 59 | | if (property.NameEquals("locations")) |
| | 60 | | { |
| 2452 | 61 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 62 | | { |
| | 63 | | continue; |
| | 64 | | } |
| 2452 | 65 | | List<string> array = new List<string>(); |
| 9808 | 66 | | foreach (var item in property.Value.EnumerateArray()) |
| | 67 | | { |
| 2452 | 68 | | if (item.ValueKind == JsonValueKind.Null) |
| | 69 | | { |
| 0 | 70 | | array.Add(null); |
| | 71 | | } |
| | 72 | | else |
| | 73 | | { |
| 2452 | 74 | | array.Add(item.GetString()); |
| | 75 | | } |
| | 76 | | } |
| 2452 | 77 | | locations = array; |
| 2452 | 78 | | continue; |
| | 79 | | } |
| 7356 | 80 | | if (property.NameEquals("capabilities")) |
| | 81 | | { |
| 2452 | 82 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 83 | | { |
| | 84 | | continue; |
| | 85 | | } |
| 2452 | 86 | | List<SKUCapability> array = new List<SKUCapability>(); |
| 56000 | 87 | | foreach (var item in property.Value.EnumerateArray()) |
| | 88 | | { |
| 25548 | 89 | | if (item.ValueKind == JsonValueKind.Null) |
| | 90 | | { |
| 0 | 91 | | array.Add(null); |
| | 92 | | } |
| | 93 | | else |
| | 94 | | { |
| 25548 | 95 | | array.Add(SKUCapability.DeserializeSKUCapability(item)); |
| | 96 | | } |
| | 97 | | } |
| 2452 | 98 | | capabilities = array; |
| 2452 | 99 | | continue; |
| | 100 | | } |
| 4904 | 101 | | if (property.NameEquals("restrictions")) |
| | 102 | | { |
| 2452 | 103 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 104 | | { |
| | 105 | | continue; |
| | 106 | | } |
| 2452 | 107 | | List<Restriction> array = new List<Restriction>(); |
| 0 | 108 | | foreach (var item in property.Value.EnumerateArray()) |
| | 109 | | { |
| 0 | 110 | | if (item.ValueKind == JsonValueKind.Null) |
| | 111 | | { |
| 0 | 112 | | array.Add(null); |
| | 113 | | } |
| | 114 | | else |
| | 115 | | { |
| 0 | 116 | | array.Add(Restriction.DeserializeRestriction(item)); |
| | 117 | | } |
| | 118 | | } |
| 2452 | 119 | | restrictions = array; |
| | 120 | | continue; |
| | 121 | | } |
| | 122 | | } |
| 2452 | 123 | | return new SkuInformation(name, tier, resourceType, kind, locations, capabilities, restrictions); |
| | 124 | | } |
| | 125 | | } |
| | 126 | | } |