| | 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.Network.Models |
| | 13 | | { |
| | 14 | | public partial class AvailableDelegation |
| | 15 | | { |
| | 16 | | internal static AvailableDelegation DeserializeAvailableDelegation(JsonElement element) |
| | 17 | | { |
| 0 | 18 | | string name = default; |
| 0 | 19 | | string id = default; |
| 0 | 20 | | string type = default; |
| 0 | 21 | | string serviceName = default; |
| 0 | 22 | | IReadOnlyList<string> actions = default; |
| 0 | 23 | | foreach (var property in element.EnumerateObject()) |
| | 24 | | { |
| 0 | 25 | | if (property.NameEquals("name")) |
| | 26 | | { |
| 0 | 27 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 28 | | { |
| | 29 | | continue; |
| | 30 | | } |
| 0 | 31 | | name = property.Value.GetString(); |
| 0 | 32 | | continue; |
| | 33 | | } |
| 0 | 34 | | if (property.NameEquals("id")) |
| | 35 | | { |
| 0 | 36 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 37 | | { |
| | 38 | | continue; |
| | 39 | | } |
| 0 | 40 | | id = property.Value.GetString(); |
| 0 | 41 | | continue; |
| | 42 | | } |
| 0 | 43 | | if (property.NameEquals("type")) |
| | 44 | | { |
| 0 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 0 | 49 | | type = property.Value.GetString(); |
| 0 | 50 | | continue; |
| | 51 | | } |
| 0 | 52 | | if (property.NameEquals("serviceName")) |
| | 53 | | { |
| 0 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 0 | 58 | | serviceName = property.Value.GetString(); |
| 0 | 59 | | continue; |
| | 60 | | } |
| 0 | 61 | | if (property.NameEquals("actions")) |
| | 62 | | { |
| 0 | 63 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | List<string> array = new List<string>(); |
| 0 | 68 | | foreach (var item in property.Value.EnumerateArray()) |
| | 69 | | { |
| 0 | 70 | | if (item.ValueKind == JsonValueKind.Null) |
| | 71 | | { |
| 0 | 72 | | array.Add(null); |
| | 73 | | } |
| | 74 | | else |
| | 75 | | { |
| 0 | 76 | | array.Add(item.GetString()); |
| | 77 | | } |
| | 78 | | } |
| 0 | 79 | | actions = array; |
| | 80 | | continue; |
| | 81 | | } |
| | 82 | | } |
| 0 | 83 | | return new AvailableDelegation(name, id, type, serviceName, actions); |
| | 84 | | } |
| | 85 | | } |
| | 86 | | } |