| | | 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 Alias |
| | | 15 | | { |
| | | 16 | | internal static Alias DeserializeAlias(JsonElement element) |
| | | 17 | | { |
| | 104240 | 18 | | string name = default; |
| | 104240 | 19 | | IReadOnlyList<AliasPath> paths = default; |
| | 104240 | 20 | | AliasType? type = default; |
| | 104240 | 21 | | string defaultPath = default; |
| | 104240 | 22 | | AliasPattern defaultPattern = default; |
| | 833936 | 23 | | foreach (var property in element.EnumerateObject()) |
| | | 24 | | { |
| | 312728 | 25 | | if (property.NameEquals("name")) |
| | | 26 | | { |
| | 104240 | 27 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 28 | | { |
| | | 29 | | continue; |
| | | 30 | | } |
| | 104240 | 31 | | name = property.Value.GetString(); |
| | 104240 | 32 | | continue; |
| | | 33 | | } |
| | 208488 | 34 | | if (property.NameEquals("paths")) |
| | | 35 | | { |
| | 104240 | 36 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 37 | | { |
| | | 38 | | continue; |
| | | 39 | | } |
| | 104240 | 40 | | List<AliasPath> array = new List<AliasPath>(); |
| | 221024 | 41 | | foreach (var item in property.Value.EnumerateArray()) |
| | | 42 | | { |
| | 6272 | 43 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 44 | | { |
| | 0 | 45 | | array.Add(null); |
| | | 46 | | } |
| | | 47 | | else |
| | | 48 | | { |
| | 6272 | 49 | | array.Add(AliasPath.DeserializeAliasPath(item)); |
| | | 50 | | } |
| | | 51 | | } |
| | 104240 | 52 | | paths = array; |
| | 104240 | 53 | | continue; |
| | | 54 | | } |
| | 104248 | 55 | | if (property.NameEquals("type")) |
| | | 56 | | { |
| | 0 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 58 | | { |
| | | 59 | | continue; |
| | | 60 | | } |
| | 0 | 61 | | type = property.Value.GetString().ToAliasType(); |
| | 0 | 62 | | continue; |
| | | 63 | | } |
| | 104248 | 64 | | if (property.NameEquals("defaultPath")) |
| | | 65 | | { |
| | 104216 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 67 | | { |
| | | 68 | | continue; |
| | | 69 | | } |
| | 104216 | 70 | | defaultPath = property.Value.GetString(); |
| | 104216 | 71 | | continue; |
| | | 72 | | } |
| | 32 | 73 | | if (property.NameEquals("defaultPattern")) |
| | | 74 | | { |
| | 32 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 76 | | { |
| | | 77 | | continue; |
| | | 78 | | } |
| | 32 | 79 | | defaultPattern = AliasPattern.DeserializeAliasPattern(property.Value); |
| | | 80 | | continue; |
| | | 81 | | } |
| | | 82 | | } |
| | 104240 | 83 | | return new Alias(name, paths, type, defaultPath, defaultPattern); |
| | | 84 | | } |
| | | 85 | | } |
| | | 86 | | } |