| | 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 Subscription |
| | 15 | | { |
| | 16 | | internal static Subscription DeserializeSubscription(JsonElement element) |
| | 17 | | { |
| 24 | 18 | | string id = default; |
| 24 | 19 | | string subscriptionId = default; |
| 24 | 20 | | string displayName = default; |
| 24 | 21 | | string tenantId = default; |
| 24 | 22 | | SubscriptionState? state = default; |
| 24 | 23 | | SubscriptionPolicies subscriptionPolicies = default; |
| 24 | 24 | | string authorizationSource = default; |
| 24 | 25 | | IReadOnlyList<ManagedByTenant> managedByTenants = default; |
| 24 | 26 | | IReadOnlyDictionary<string, string> tags = default; |
| 360 | 27 | | foreach (var property in element.EnumerateObject()) |
| | 28 | | { |
| 156 | 29 | | if (property.NameEquals("id")) |
| | 30 | | { |
| 24 | 31 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 32 | | { |
| | 33 | | continue; |
| | 34 | | } |
| 24 | 35 | | id = property.Value.GetString(); |
| 24 | 36 | | continue; |
| | 37 | | } |
| 132 | 38 | | if (property.NameEquals("subscriptionId")) |
| | 39 | | { |
| 24 | 40 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 41 | | { |
| | 42 | | continue; |
| | 43 | | } |
| 24 | 44 | | subscriptionId = property.Value.GetString(); |
| 24 | 45 | | continue; |
| | 46 | | } |
| 108 | 47 | | if (property.NameEquals("displayName")) |
| | 48 | | { |
| 24 | 49 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 50 | | { |
| | 51 | | continue; |
| | 52 | | } |
| 24 | 53 | | displayName = property.Value.GetString(); |
| 24 | 54 | | continue; |
| | 55 | | } |
| 84 | 56 | | if (property.NameEquals("tenantId")) |
| | 57 | | { |
| 8 | 58 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 59 | | { |
| | 60 | | continue; |
| | 61 | | } |
| 8 | 62 | | tenantId = property.Value.GetString(); |
| 8 | 63 | | continue; |
| | 64 | | } |
| 76 | 65 | | if (property.NameEquals("state")) |
| | 66 | | { |
| 24 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 24 | 71 | | state = property.Value.GetString().ToSubscriptionState(); |
| 24 | 72 | | continue; |
| | 73 | | } |
| 52 | 74 | | if (property.NameEquals("subscriptionPolicies")) |
| | 75 | | { |
| 24 | 76 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 24 | 80 | | subscriptionPolicies = SubscriptionPolicies.DeserializeSubscriptionPolicies(property.Value); |
| 24 | 81 | | continue; |
| | 82 | | } |
| 28 | 83 | | if (property.NameEquals("authorizationSource")) |
| | 84 | | { |
| 8 | 85 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 8 | 89 | | authorizationSource = property.Value.GetString(); |
| 8 | 90 | | continue; |
| | 91 | | } |
| 20 | 92 | | if (property.NameEquals("managedByTenants")) |
| | 93 | | { |
| 8 | 94 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 95 | | { |
| | 96 | | continue; |
| | 97 | | } |
| 8 | 98 | | List<ManagedByTenant> array = new List<ManagedByTenant>(); |
| 0 | 99 | | foreach (var item in property.Value.EnumerateArray()) |
| | 100 | | { |
| 0 | 101 | | if (item.ValueKind == JsonValueKind.Null) |
| | 102 | | { |
| 0 | 103 | | array.Add(null); |
| | 104 | | } |
| | 105 | | else |
| | 106 | | { |
| 0 | 107 | | array.Add(ManagedByTenant.DeserializeManagedByTenant(item)); |
| | 108 | | } |
| | 109 | | } |
| 8 | 110 | | managedByTenants = array; |
| 8 | 111 | | continue; |
| | 112 | | } |
| 12 | 113 | | if (property.NameEquals("tags")) |
| | 114 | | { |
| 12 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 12 | 119 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 64 | 120 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 121 | | { |
| 20 | 122 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| 0 | 124 | | dictionary.Add(property0.Name, null); |
| | 125 | | } |
| | 126 | | else |
| | 127 | | { |
| 20 | 128 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 129 | | } |
| | 130 | | } |
| 12 | 131 | | tags = dictionary; |
| | 132 | | continue; |
| | 133 | | } |
| | 134 | | } |
| 24 | 135 | | return new Subscription(id, subscriptionId, displayName, tenantId, state, subscriptionPolicies, authorizatio |
| | 136 | | } |
| | 137 | | } |
| | 138 | | } |