| | 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 ManagementLockObject : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Id != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("id"); |
| 0 | 22 | | writer.WriteStringValue(Id); |
| | 23 | | } |
| 0 | 24 | | if (Type != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("type"); |
| 0 | 27 | | writer.WriteStringValue(Type); |
| | 28 | | } |
| 0 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 0 | 34 | | writer.WritePropertyName("properties"); |
| 0 | 35 | | writer.WriteStartObject(); |
| 0 | 36 | | writer.WritePropertyName("level"); |
| 0 | 37 | | writer.WriteStringValue(Level.ToString()); |
| 0 | 38 | | if (Notes != null) |
| | 39 | | { |
| 0 | 40 | | writer.WritePropertyName("notes"); |
| 0 | 41 | | writer.WriteStringValue(Notes); |
| | 42 | | } |
| 0 | 43 | | if (Owners != null) |
| | 44 | | { |
| 0 | 45 | | writer.WritePropertyName("owners"); |
| 0 | 46 | | writer.WriteStartArray(); |
| 0 | 47 | | foreach (var item in Owners) |
| | 48 | | { |
| 0 | 49 | | writer.WriteObjectValue(item); |
| | 50 | | } |
| 0 | 51 | | writer.WriteEndArray(); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| 0 | 54 | | writer.WriteEndObject(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | internal static ManagementLockObject DeserializeManagementLockObject(JsonElement element) |
| | 58 | | { |
| 0 | 59 | | string id = default; |
| 0 | 60 | | string type = default; |
| 0 | 61 | | string name = default; |
| 0 | 62 | | LockLevel level = default; |
| 0 | 63 | | string notes = default; |
| 0 | 64 | | IList<ManagementLockOwner> owners = default; |
| 0 | 65 | | foreach (var property in element.EnumerateObject()) |
| | 66 | | { |
| 0 | 67 | | if (property.NameEquals("id")) |
| | 68 | | { |
| 0 | 69 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 70 | | { |
| | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | id = property.Value.GetString(); |
| 0 | 74 | | continue; |
| | 75 | | } |
| 0 | 76 | | if (property.NameEquals("type")) |
| | 77 | | { |
| 0 | 78 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | type = property.Value.GetString(); |
| 0 | 83 | | continue; |
| | 84 | | } |
| 0 | 85 | | if (property.NameEquals("name")) |
| | 86 | | { |
| 0 | 87 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| | 89 | | continue; |
| | 90 | | } |
| 0 | 91 | | name = property.Value.GetString(); |
| 0 | 92 | | continue; |
| | 93 | | } |
| 0 | 94 | | if (property.NameEquals("properties")) |
| | 95 | | { |
| 0 | 96 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 97 | | { |
| 0 | 98 | | if (property0.NameEquals("level")) |
| | 99 | | { |
| 0 | 100 | | level = new LockLevel(property0.Value.GetString()); |
| 0 | 101 | | continue; |
| | 102 | | } |
| 0 | 103 | | if (property0.NameEquals("notes")) |
| | 104 | | { |
| 0 | 105 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 106 | | { |
| | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | notes = property0.Value.GetString(); |
| 0 | 110 | | continue; |
| | 111 | | } |
| 0 | 112 | | if (property0.NameEquals("owners")) |
| | 113 | | { |
| 0 | 114 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | List<ManagementLockOwner> array = new List<ManagementLockOwner>(); |
| 0 | 119 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 120 | | { |
| 0 | 121 | | if (item.ValueKind == JsonValueKind.Null) |
| | 122 | | { |
| 0 | 123 | | array.Add(null); |
| | 124 | | } |
| | 125 | | else |
| | 126 | | { |
| 0 | 127 | | array.Add(ManagementLockOwner.DeserializeManagementLockOwner(item)); |
| | 128 | | } |
| | 129 | | } |
| 0 | 130 | | owners = array; |
| | 131 | | continue; |
| | 132 | | } |
| | 133 | | } |
| | 134 | | continue; |
| | 135 | | } |
| | 136 | | } |
| 0 | 137 | | return new ManagementLockObject(id, type, name, level, notes, owners); |
| | 138 | | } |
| | 139 | | } |
| | 140 | | } |